Wednesday, March 15, 2017

Redirecting to page not working?

I have this function :

public function index(Request $request){
  $email = $request->email;
 $password = $request->password;

if (!$email || !$password) {return redirect()->back();}
if (Auth::attempt(['email' => $email, 'password' => $password])) {
    // Authentication passed...
    $this->loggedUser = Auth::user();
    if($this->loggedUser){
          return redirect('http://localhost:3000/home');
    }

}
return redirect()->back()->withInput()->withErrorMessage('Uneseni podaci nisu ispravni.');

}

What i want is to redirect user if he is logged in, but nothing happend. When i open i browser preview it just say

Redirecting to http://localhost:3000/home

But it not redirect me. Any suggestion?

When i enter manually it appears



via None

Advertisement