作者:竹条蠢爱玉米 | 来源:互联网 | 2018-05-18 15:57
登录后都是跳转后home,如何跳转到上一页(登录前的页面)(没有登录前页面才跳转到home)?每次都是跳转到home这样不是很好,用户还等去倒退或者是历史记录找之前的页面{代码...}
登录后都是跳转后/home,如何跳转到上一页(
登录前的页面
)/(没有登录前页面才跳转到
home
)?
每次都是跳转到home这样不是很好,用户还等去倒退或者是历史记录找之前的页面
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect('/home');
}
return $next($request);
}
回复内容:
登录后都是跳转后/home,如何跳转到上一页(登录前的页面
)/(没有登录前页面才跳转到home
)?
每次都是跳转到home这样不是很好,用户还等去倒退或者是历史记录找之前的页面
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return redirect('/home');
}
return $next($request);
}
这样看看?
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
return Redirect::intended('/');
//return redirect('/home');
}
return $next($request);
}
public function handle($request, Closure $next)
{
if ($this->auth->check()) {
//跳转到/home页
return redirect('/home');
//登录成功后跳转登录前的那页,但一般我不这么用根据情况使用
return redirect()->back();
//我一般使用这个,成功后登录我想使用的控制器
return redirect()->action('IndexController@index');
}
return $next($request);
}