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

You have to move the

Route::get('service/create', 'ServicesController@create');

above

Route::get('service/{id}', 'ServicesController@show');

In your case, simply switch the order of the grouped routes.

Last updated 2 years ago.
0

TorchSK said:

You have to move the

Route::get('service/create', 'ServicesController@create');

above

Route::get('service/{id}', 'ServicesController@show');

In your case, simply switch the order of the grouped routes.

This solution worked.

I have those in separate authorization groups. Does this mean the routes need to be listed in order of most restrictive to least restrictive in the routes file?

Last updated 2 years ago.
0

Well... yes. I suppose it works in a way that when the first match of the route is found, this route is used.

Route::get('service/create', 'ServicesController@create');

and

Route::get('service/{id}', 'ServicesController@show');

are the same in exactly one case. When {id}=create.

So when service/{id} is first, the desired service/create route could actually never be hit.

Last updated 2 years ago.
0

Thanks for your explanation.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

delahappy delahappy Joined 20 Jun 2014

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.