Skip to content

v12.29.0 breaking change causes issues with routes name order #57118

@kajgiesbersflavour

Description

@kajgiesbersflavour

Laravel Version

12.29.0

PHP Version

8.2

Database Driver & Version

No response

Description

Before this update when calling route($routeName) it would return the last defined routename, now it returns the first defined routename.

Why this breaking change matters in our specific case

We use tenancy in our application and we have multiple routes with the same name. Previously when calling route($routeName) it would automatically return the tenant route when on the tenant, and the central route when not within tenant context, now it always returns the central route.

Please let me know if you require any additional information.

Steps To Reproduce

In your routes file:

        Route::get('firstLink', [Test::class, 'test'])->name('routeTest');
        Route::get('secondLink', [Test::class, 'test'])->name('routeTest');

Then on a random blade file:

Test link: {{route('routeTest')}}

On 12.28.1 and lower, this will return:
Test link: http://hackshield.local/secondLink
Now since 12.29.0 this returns:
Test link: http://hackshield.local/firstLink

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions