laravel - Before method with multiple role restrictions -
laravel - Before method with multiple role restrictions -
im curious know if possible prevent users don't have role of owner or administrator accessing controllers in laravel application?
yes can. can route filter.
routes.php
route::group(['prefix' => 'admin', 'before' => 'auth.admin'), function() { // routes } ]); and in filters.php
route::filter('auth.admin', function() { // logic set $isadmin true or false if(!$isadmin) { homecoming redirect::to('login')->with('flash_message', 'please login admin credentials'); } }); laravel laravel-4
Comments
Post a Comment