简体   繁体   中英

laravel 5 - catch all route (Route::controller) at the end of routes.php?

How can I use a catch-all route at the end of routes.php in laravel 5 like this?

Route::controller('{user}','PublicProfileController');

It 'destroys' the laravel debugbar and some javascripts in all views. This seems to work better:

Route::get('{user}','PublicProfileController@index');

I'm trying to have URLs like mysite.com/username with segments like mysite.com/username/photos or mysite.com/username/posts

As discussed in the comments this can be easily solved by just not using a catch all route. However there is another way.

The problem is that the routes of the packages get registered after the ones in your routes.php . You can change that by changing the order of service providers in the providers array in config/app.php .

Just make sure the service providers of the packages are listed before 'App\\Providers\\RouteServiceProvider' (that's where the applications routes.php is loaded)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM