How to use role management in laravel


Posted on 31 Jan 15 by Vickey

By using laravel packages we can manage user roles. but we can create a custom code to manage roles by using route file. For example if i am creating a function only access for admin then i can add a conditions in my routing



        Route::get('/manageusers', 'AdminController@manageusers');
    else {

           Route::get('/manageusers', function(){
           return Redirect::to('/');  });

In this code user's role id is 1 then manageusers function can accessed otherwise it will redirect to home page

If this post help you reduce time to develop, you can help me to maintain this website :)