php - How do I make a Catch-All Route in Laravel 5.2 -


i need laravel 5.2 routes.php entry catch traffic specific domain.com/premium-section of site can prompt people become members before accessing premium content.

i'll answer own question ~ , people can use info.

you catch 'all' using regex on parameter.

route::group(['prefix' => 'premium-section'], function () {     // other routes     ...     route::get('{any}', function ($any) {         ...     })->where('any', '.*'); }); 

also can catch whole group if no routes defined optional param.

route::get('{any?}', function ($any = null) {     ... })->where('any', '.*'); 

this last 1 catch 'domain.com/premium-section' well.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -