Laravel登录后重定向回 [英] Laravel redirect back after login
本文介绍了Laravel登录后重定向回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
登录后如何重定向返回页面?在Laravel 5.2中
How can I redirect back page after login? in Laravel 5.2
AuthController
AuthController
protected $redirectTo = '/';
RedirectUsers
RedirectUsers
<?php
namespace Illuminate\Foundation\Auth;
trait RedirectsUsers
{
/**
* Get the post register / login redirect path.
*
* @return string
*/
public function redirectPath()
{
if (property_exists($this, 'redirectPath')) {
return $this->redirectPath;
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/';
}
}
推荐答案
在您在控制器中编写的auth函数中.会是这样的:
In your auth function which you've written in the controller. It'll be something like this:
function xyz() {
// your function code
return Redirect::back();
}
这篇关于Laravel登录后重定向回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文