Php Laravel如何在登录时获取电子邮件值?

Php Laravel如何在登录时获取电子邮件值?,php,laravel,authentication,laravel-5.2,Php,Laravel,Authentication,Laravel 5.2,我使用的是Laravel5.2,我使用的是php ArtisanMake:auth 当我成功登录(使用email和密码)时,我希望页面url如下:home/{email} 我已将受保护的$redirectTo='/'更改为toprotected$redirectTo='home/{email}'在AuthController.php中。但我认为它不起作用。页面url更改如下http://localhost:8000/home/%7Bemail%7D 我该怎么做 ++ 如何在AuthControl

我使用的是Laravel5.2,我使用的是
php ArtisanMake:auth

当我成功登录(使用
email
和密码)时,我希望页面url如下:
home/{email}

我已将受保护的$redirectTo='/'更改为
to
protected$redirectTo='home/{email}'
AuthController.php
中。但我认为它不起作用。页面url更改如下
http://localhost:8000/home/%7Bemail%7D

我该怎么做

++


如何在
AuthController
上获取
email
值?

您需要从
email
请求中获取值,如下所示

public function __constructor(Request $request)
{
    $email = $request->input('email');
    $this->redirectTo = "home/{$email}";
}
可以使用构造函数替换重定向中的值


看来你在控制器中使用了刀片语法。@ShubhamoyChakrabarty抱歉,我不懂QQ。我只更改了控制器上的这一行:
protected$redirectTo='/'。执行此命令后。在生成的AuthController.phpIs公共函数\uuu构造函数中,对吗?不是公共函数构造
AuthController
已经有了
public function\uu-construct(){$this->middleware($this->guestMiddleware(),['except'=>'logout']);}
并且我粘贴了它,没有发生任何事情autocontroller使用authenticates和registersusers;->使用AuthenticatesUsers;->使用重定向器
trait RedirectsUsers{public function redirectPath(){if(property_exists($this,'redirectPath')){return$this->redirectPath;}return property_exists($this,'redirectTo')?$this->redirectTo:'/home';}}
您只需添加构造函数字符串,就像我上面写的那样,它就会工作