(PHP) Using route groups in Laravel to protect routes


To protect routes, in Laravel, from unauthorized visits you can use route groups.
All routes in group will be affected by the auth before filter.

[php]
Route::group(array(‘before’ => ‘auth’), function() {

Route::get(‘controlpanel’, ‘CustomerPanel@showPanel’);
Route::get(‘secret’, ‘Secret@showSecret’);
Route::post(‘setup’, ‘SetupController@doSetup’);

});

[/php]

Leave a Reply

Your email address will not be published. Required fields are marked *