Laravel + phpCAS:登录后,重定向回同一页面,需要登录

时间:2018-04-11 09:06:48

标签: laravel laravel-5.3 laravel-5.4

我正在使用Laravel开发一个项目,我们使用phpCAS进行用户身份验证。我正在使用这个Laravel包用于phpCAS:https://github.com/subfission/cas

用户通过身份验证后,我希望将他/她返回到他/她被重定向到CAS服务器登录的URL。

我使用了url() - > previous();但它在谷歌浏览器中返回有关引用URL(控制器/操作)的错误信息。

我怎样才能实现它?谢谢!

1 个答案:

答案 0 :(得分:1)

使用intended()方法

The intended method on the redirector will redirect the user to the URL they were attempting to access before being intercepted by the authentication middleware. A fallback URI may be given to this method in case the intended destination is not available.

示例:return redirect()->intended('dashboard');