php 登录失败重定向,php-登录重定向到错误的位置

当我登录而不是重定向到仪表板时,我重定向到了/在我的身份验证控制器中,但我注释掉了以下行,但是我仍然重定向到了错误的位置,为什么?

我已经清除了缓存php artisan cache:clear,没有运气

行注释掉了:

$redirectTo =’/’;

登录功能:

public function postLogin(Request $request)

{

$credentials = $this->getLoginCredentials($request);

if(Auth::attempt($credentials))

{

redirect()->intended('dashboard');

}

return redirect()->back();

}

路线:

Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => 'web'], function() {

/* Admin Auth */

Route::get('login', 'Auth\AuthController@getLogin');

Route::post('login', 'Auth\AuthController@postLogin');

Route::get('register', 'Auth\AuthController@getRegister');

Route::post('register', 'Auth\AuthController@postRegister');

Route::get('logout', 'Auth\AuthController@getLogout');

Route::group(['middleware' => 'auth.admin'], function(){

/*Admin Dashboard Routes */

Route::get('dashboard', 'AdminController@getDashboard');

});

});

解决方法:

您忘记了redirect()的返回:

public function postLogin(Request $request)

{

$credentials = $this->getLoginCredentials($request);

if(Auth::attempt($credentials))

{

return redirect()->intended('dashboard'); // here

}

return redirect()->back();

}

标签:laravel,laravel-5-2,redirect,php

来源: https://codeday.me/bug/20191118/2031828.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值