Laravel Auth-登录时重定向

Laravel Auth-登录时重定向,laravel,authentication,laravel-5.2,Laravel,Authentication,Laravel 5.2,我有一个小型的Laravel5.2项目,我正在工作。我使用了内置的auth包来处理这个概念验证的登录。但是,当我登录时,即使设置了以下内容,它也会将我重定向到/路径 protected $redirectTo = '/specialRoute'; 是否还有其他地方需要我设置登录名以转到/special route?您可以尝试更改照明\Foundation\Auth\RedirectsUsers特征中的默认$redirectTo值。将下面的行添加到AuthController Auth/Auth

我有一个小型的Laravel5.2项目,我正在工作。我使用了内置的auth包来处理这个概念验证的登录。但是,当我登录时,即使设置了以下内容,它也会将我重定向到
/
路径

protected $redirectTo = '/specialRoute';

是否还有其他地方需要我设置登录名以转到
/special route

您可以尝试更改
照明\Foundation\Auth\RedirectsUsers
特征中的默认$redirectTo值。

将下面的行添加到AuthController

Auth/AuthController.php

此重定向路径将用于成功登录和成功注册

重写postRegister函数也应该起作用。您可以在AuthController中执行此操作:

 public function postRegister(Request $request)
 {
    $validator = $this->registrar->validator($request->all());
    if ($validator->fails())
    {
        $this->throwValidationException(
            $request, $validator
        );
    }
    $this->auth->login($this->registrar->create($request->all()));     
    // Now you can redirect!
    return redirect('/specialRoute');
 }

如果要重定向到路由,有关重定向的详细信息:

您在哪个文件中声明了此类属性?您是否用包覆盖了AuthController?您是否声明受保护的$redirectTo='/specialRoute';在AuthController.php中,您是否在route.php中声明specialRoute?您是否使用了任何中间件?是否可能重复
 public function postRegister(Request $request)
 {
    $validator = $this->registrar->validator($request->all());
    if ($validator->fails())
    {
        $this->throwValidationException(
            $request, $validator
        );
    }
    $this->auth->login($this->registrar->create($request->all()));     
    // Now you can redirect!
    return redirect('/specialRoute');
 }