[英]Laravel redirect back after login
How can I redirect back page after login? 如何在登录后重定向页面? in Laravel 5.2
在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 : '/';
}
}
You can do it by using either of these two options. 您可以使用这两个选项中的任何一个来完成。
In your auth function which you've written in the controller. 在您在控制器中编写的auth功能中。 It'll be something like this:
它会是这样的:
function xyz() {
// your function code
return Redirect::back();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.