I believe that URLs are indexed and keyed on their URL - so therefore the first one would be overridden completely by the first one.
I think so anyway, can anyone else confirm this?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all, i have set up two routes like so..
Route::get('messages', [
'as' => 'messages.inbox',
'uses' => 'MessagesController@inbox'
]);
Route::get('messages', [
'as' => 'messages',
'uses' => 'MessagesController@inbox'
]);
So, they have the same URL, Controller, Action, but have different names.
You might wonder why anyone would do this, and my only reason is that the app points to the URL in various places using either of the two names, and so I didn't want to go through and change them all to use one named route.
What i've done has been working fine, but today I noticed that my local copy is throwing an error saying that the route messages.inbox doesn't exist.
It was working previously on my local copy, and the only change I can think of is that I ran a composer update yesterday.
Presumably the errors is being thrown because the second route is overwriting the first, due to them having the same URL.
Is this caused by the composer update? Both the composer.js files on my local copy and the test server are the same, so why is one throwing an error and the other not?
I believe that URLs are indexed and keyed on their URL - so therefore the first one would be overridden completely by the first one.
I think so anyway, can anyone else confirm this?
Please or to participate in this conversation.