-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Overriding routes by order of declaration. #17
Comments
Yeah, you're probably right. Will look into it. |
It's a simple fix, just drop the I'll send a PR. |
OK, Thanks. |
Allow routes to override by order of declaration. Fixes #17.
The overriding of routes don't work in every case. If the semantic is equal but the spelling is different the router use the first declared route. Works: Route::get('part1/{part2}/{part3}', function($part2, $part3)
{
return 'This does not work. The second route is used.';
});
Route::get('part1/{part2}/{part3}', function($part2, $part3)
{
return 'This one will be run.';
}); Fails: Route::get('part1/{part2}/{part3}', function($part2, $part3)
{
return 'This one will be run.';
});
Route::get('part1/{part4}/{part5}', function($part4, $part5)
{
return 'This does not work. The first route is used.';
}); Fails: Route::get('part1/{part2}/{part3}', function($part2, $part3)
{
return 'This one will be run.';
});
Route::get('part1/test/test', function()
{
return 'This does not work. The first route is used.';
}); |
When a route is added the name generated is appended with
microtime(true)
. This will mean that the first route to be declared will always be given precedence. Should it not be the order in which the two identically named routes are defined.Currently:
This may be intentional but it makes it really hard to override a route.
The text was updated successfully, but these errors were encountered: