I want to archive the following
User entries β Assigning privileges from the database β They can only see allowed routes
So far I have managed to contact us:
$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 he is active or inactive, and then saves the privilege in my session. What's next? How to protect your routes?
thanks
source share