Mah*_*A R 1 php authentication laravel url-redirection laravel-5.2
我是laravel的新手,正在做一个样本项目作为学习目的.我使用命令创建了身份验证:
php artisan make:auth
Run Code Online (Sandbox Code Playgroud)
我已经在Authcontroller.php中为所有成功的登录/注册提供了重定向链接:
protected $redirectTo = '/admin';
Run Code Online (Sandbox Code Playgroud)
所有这些都工作正常,我的问题是当我尝试使用laravel 5.2内置auth控制器上的密码重置选项重置密码时,我可以使用新密码重置旧密码.但重置密码后,它会被重定向到examplelaravel.com/home这样的链接.根据我在Authcontroller.php中的重定向链接(protected $ redirectTo ='/ admin';)fgiven,它不会发送到examplelaravel.com/admin.
在浏览我的laravel项目中的每个文件时,我看到一个名为vendor\laravel\framework\src\Illuminate\Foundation\Auth\RedirectsUsers.php的文件,其中包含如下方法:
public function redirectPath()
{
if (property_exists($this, 'redirectPath')) {
return $this->redirectPath;
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
}
Run Code Online (Sandbox Code Playgroud)
我在上述文件中将/ home更改为/ admin,并且在成功修改密码后我的重定向问题得到修复.但我不知道这是否是正确的方法?是否正确编辑供应商文件夹内的文件,就像我上面所做的那样?请帮我.提前致谢.
归档时间: |
|
查看次数: |
1274 次 |
最近记录: |