Welcome Guest, Not a member yet? Register   Sign In
Order resource route in routes.php
#1

Hello,

In the manual of Codeigniter 4 stands:
The routes are matched in the order they are specified, so if you have a resource photos above a get ‘photos/poll’ the show action’s route for the resource line will be matched before the get line. 

When trying this the recource is working/showing in the end, not on the place I put it in.

Sor when you add something like this in your routes.php:

$routes->resource('photos');

$routes->add('a', 'Home::a');
$routes->add('b', 'Home::b');
$routes->add('c', 'Home::c');

$routes->add('(:any)', 'Home::i/$1');

http://www.example.com/photos gives a "File not found"
And the recource Photos.php when looked up in the debugbar will have the last place in the ordering instead of the first place.

Why is this?
And how to change this?

Thank you for your help.

Ubel Jan van Wijhe
Reply


Messages In This Thread
Order resource route in routes.php - by ubeljan - 07-14-2018, 01:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB