Support the ongoing development of Laravel.io →
posted 7 years ago

Here are the relevant routes:

Auth::routes();

Route::group(['prefix' => 'admin'], function () {
    Voyager::routes();
});

Route::get('/', [
    'as' => 'home',
    'uses' => 'BusinessController@categories'
]);

Route::get('/{category}',  [
    'as' => 'business.category',
    'uses' => 'BusinessController@cities'
]);

Route::get('/{category}/{state}/{city}', [
    'as' => 'business.city',
    'uses' => 'BusinessController@listings'
]);

Whenever I try to use the Voyager Administration panel and navigate to any route with three parameters (i.e. /admin/users/2/, admin/posts/1, admin/media/1) the route matches to the business.city route. This happens regardless of if I place the voyager routes above or below the BusinessController routes. I don't want to place the business.city route into a group because it would make the URI a bit longer and less intuitive.

I would think it would try and match the admin prefixed routes before it went with the wildcard route but I guess it doesn't.

What's the best solution to this issue?

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.