Reputation: 53
I am looking to archive the the following
Userlogs in -> Assigned a privilege from the DB -> They can only see allowed routes only
So far i have been able to reach here:
$user = Usercredential::where('username','=',Auth::user()->username)->get();
foreach ($user as $u ) {
$status = $u->userstatus;
$userPriv = $u->userpriviledge;
if ($status == 0){
Session::put('user_priv',$userPriv);
}
else{
return Redirect::to_route('home')->with('message','Inactive users cannot login');
}
Which checks the status of the user if active or inactive then stores the priviledge in my session. What next? How do i protect my routes?
Thanks
Upvotes: 2
Views: 12880
Reputation: 53
For those in the future who are looking for this solution
Will be very helpful, thanks Rodri for your pointer. I appreciate.
Upvotes: 1
Reputation: 2527
I recommend you the Laravel 4 Package called: ENTRUST who provide a way to add Role-based
Upvotes: 4