php - Laravel Roles and authentication to routes -
i looking archive the following
userlogs in -> assigned privilege db -> can see allowed routes only
so far have been able reach here:
$user = usercredential::where('username','=',auth::user()->username)->get(); foreach ($user $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 status of user if active or inactive stores priviledge in session. next? how protect routes?
thanks
i recommend laravel 4 package called: entrust provide way add role-based
Comments
Post a Comment