-
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
A bug was detected when using the prefix
method without group
method
#49039
Comments
Hey there, thanks for reporting this issue. We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here? Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue. Thanks! |
Repository: https://github.com/andrey-helldar/laravel-issue-49039 Helldar@HellPC MINGW64 /d/domains/bug-report (main)
$ php artisan route:list
POST api/orders/some .................................................... orders.index › OrderController@index
POST webhook/api/some ............................................................ webhook › WebhookController |
Hello, I have tested with the examples provider, and I have the same result as @andrey-helldar |
I've also noticed that it doesn't matter what route and controller names are used. The only important thing is to call the // incorrect
app('router')->prefix('some')->get('foo', SomeController::class);
// correct
app('router')->prefix('some')->group(
fn () => app('router')->get('foo', SomeController::class);
); For example: app('router')->name('foo')->prefix('foo')->get('some', WebhookController::class);
app('router')->name('foo')->prefix('foo')->post('some', WebhookController::class);
app('router')->name('foo')->prefix('foo')->put('some', WebhookController::class);
app('router')->name('foo')->prefix('foo')->patch('some', WebhookController::class);
app('router')->name('foo')->prefix('foo')->delete('some', WebhookController::class);
app('router')->name('bar')->prefix('bar')->get('some', [WebhookController::class, 'some']);
app('router')->name('bar')->prefix('bar')->post('some', [WebhookController::class, 'some']);
app('router')->name('bar')->prefix('bar')->put('some', [WebhookController::class, 'some']);
app('router')->name('bar')->prefix('bar')->patch('some', [WebhookController::class, 'some']);
app('router')->name('bar')->prefix('bar')->delete('some', [WebhookController::class, 'some']); Result:
|
I would feel the current behavior is expected, since |
Laravel Version
10.32.1
PHP Version
8.2.12
Database Driver & Version
No response
Description
When using the
prefix
method on routes that are not groups, it incorrectly generates the destination URL.It should be like this:
But this option is displayed instead:
Steps To Reproduce
routes.bug.mp4
The text was updated successfully, but these errors were encountered: