(PHP) Using route groups in Laravel to protect routes

By | March 18, 2015

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.

Route::group(array('before' => 'auth'), function() {

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


Leave a Reply

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