Skip to content

Route Parameters Issues #55891

@mawuli-agbenyo-creator

Description

@mawuli-agbenyo-creator

Laravel Version

12.10.2

PHP Version

8.2

Database Driver & Version

No response

Description

I'm not sure if this is a bug or if I just don't fully understand how it works.

I'm having an issue related to Laravel route parameters.

I have the following two routes defined:

Route::get('/users/{id}', [UserController::class, 'getUserById']);
Route::get('/users/discover', [UserController::class, 'discover']);

The problem is with the route hierarchy. When I try to access /users/discover, it ends up calling the getUserById method instead, as if discover is being treated as an {id}.

Is this expected behavior?

Steps To Reproduce

Image

Image

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