Support the ongoing development of Laravel.io →
Configuration Requests Views
Last updated 2 years ago.
0

For your create url you don't need the $item variable and also the method isn't needed.

Just do

Route::get('items/create', function() {
    return View::make('items.create');
});
Last updated 2 years ago.
0

Thanks for the quick answer, but that doesn't answer my real question: Why the order of the routes in the routes.php file affects the way the project works? I think that it shouldn't matter how they are set up. If I try the URI /items/create I should go to the app/views/items/create.php file. However, changing the place the routes are in the routes file produces an error.

Last updated 2 years ago.
0

Yes because its looking for an {id} if you place create after the items/{id}. So thats working as expected.

Last updated 2 years ago.
0

juste because {id} accept "create" as argument in your route if you put this route above.. till you do not filter for exemple with a

Route::pattern( 'id', '\d+' );

or a where filter to your route,

Route::get(...)->where(array('id' => '[0-9]+' ....

order will matter! :d

Last updated 2 years ago.
0

@eriktisme @desharpen Thanks a lot! I can see the light now...

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.