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

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -