Laravel 重定向到页面不工作?

Laravel 重定向到页面不工作?,laravel,laravel-5.2,Laravel,Laravel 5.2,我有这个功能: public function index(Request $request){ $email = $request->email; $password = $request->password; if (!$email || !$password) {return redirect()->back();} if (Auth::attempt(['email' => $email, 'password' => $password])) {

我有这个功能:

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.');

}
我想要的是重定向用户,如果他登录了,但什么也没发生。当我打开浏览器预览时,只需说

Redirecting to http://localhost:3000/home
但它并没有改变我的方向。有什么建议吗


当我手动输入时,会显示将重定向地址更改为:

return redirect('home');

如果要重定向到绝对URL,可以尝试以下操作:

return redirect(url('http://localhost:8000/home'));
或者,您可以尝试使用以下相对URL:

return redirect('/home'));
第一个是坏的,因为如果您的域()是 更改然后所有的链接都需要更改。所以第二 方法更好


尝试
重定向('/home')
同样的问题。。它只是在预览中说redirectin,但什么也没有发生。此方法中的其他重定向工作正常吗?这是我的问题…重定向在allIm不起作用,为此使用angularjs2..如果这对你意味着什么,那么什么都不会发生,只是在预览中说:重定向到。就这样。。。。在我的浏览器中,路径是。我知道,但对我来说它不起作用。。。可能是因为我在使用Angulari,如果您发送AJAX请求,重定向将不起作用。您必须使用Javascript或Angular Routings从前端重定向,这样我才能返回json响应,然后在Angular和set route中处理它?