i'm new in laravel. i want to set redirect to example.com
if logged success. i have change in RedirectIfAuthenticated
class
from
public function handle($request, Closure $next)
{
if ($this->auth->check())
{
return new RedirectResponse(url('/home'));
}
return $next($request);
}
to
public function handle($request, Closure $next)
{
if ($this->auth->check())
{
return new RedirectResponse(url('/'));
}
return $next($request);
}
it still redirect to example.com/home
is there someone who can help?
Why not do redirection from your controller: I believe you only want to redirect user once and not whenever auth middleware is called.
public function postLogin()
{
$credentials = [
'email' => Input::get('email'),
'password' => Input::get('password')
];
if (Auth::attempt($credentials, Input::has('remember'))) return redirect(url('/home'));
}