mardi 2 février 2016

how to redirect in laravel 5 after authenticating particular user

I am new to Laravel and I am trying to redirect 2 different types of users on different pages, based on their ID stored in database.

I found the authenticating redirection code in redirectifAuthenticated.php file . I don't know what wrong I am doing in code to get a successful redirection. below is my code.

public function handle($request, Closure $next)
        {

                if ($this->auth->check())
                {

$userId = Auth::id();

if($userId == '1'){

return new RedirectResponse(url('/symptoms/view'));

}
else 
{

return new RedirectResponse(url('/home'));

}

                }

                return $next($request);
        }


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire