When you first log in the user, couldn't you also have a field in the database called role, where its either
admin or user? Then once logged in if the role field is admin, maybe set a session to user_role.
Then:
public function handle($request, Closure $next)
{
if (Session::get('user_role') == "admin"))
{
return redirect()->guest('/');
}
return $next($request);
}
I checked something:
Right after login in the AuthController:
$yourvar = $request->user()->role;
Now $yourvar is the role, do whatever works now.
This is L5 right?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community