I have an table hosts and want to redirect to a different page when the user is admin (DB is_admin boolean). I use the following Authentication method:
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check())
{
if(Auth::user()->isAdmin == 1) {
return redirect('/home');
}
else
{
return redirect('/api');
}
}
return $next($request);
}
My hosts class:
public function isAdmin()
{
return $this->is_admin;
}
}
Can anyone help me?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lhschl
via IFTTT
Aucun commentaire:
Enregistrer un commentaire