laravel redirect if logged in
go to
App\Http\Middleware\RedirectIfAuthenticated
then change it from
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect('/home');
}
return $next($request);
}
to
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect('/admin');
}
return $next($request);
}
Add this to your AuthController
:
protected $redirectTo = '/admin';
This tells all the redirect methods in the various traits to redirect there instead of to /home
.