在Laravel注销后如何保持在同一页面上 [英] How to stay on the same page after a logout in Laravel

查看:69
本文介绍了在Laravel注销后如何保持在同一页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如问题标题所暗示的,我想知道如何设置我的网站,以便用户注销后停留在同一页面上. 特别是,我想知道Laravel是否提供语法来实现此目的.我希望在Laravel中使用最佳实践.

As the question title suggests, I'm wondering how to set my website up so that the user stays on the same page after a log out. In particular, I'm wondering if Laravel provides syntax to do this. I'm hoping to use best practice for within Laravel.

例如:

登录链接显示在每个页面的顶部.鲍勃(Bob)已登录并正在查看关于"页面.鲍勃单击注销". Bob已注销,并重定向回关于页面.

The log in link is displayed at the top of every every page. Bob is logged in and viewing the 'about' page. Bob clicks 'Log Out.' Bob is logged out and redirected back to the about page.

我认为这将是一种不错的方法,因为auth过滤器可以确定该页面是否受保护并进行相应的重定向.

I figured this would be a nice way to do it, since the auth filter can then determine if the page is protected or not and redirect accordingly.

如果您从可用性的角度来看这是不好的做法,我也很感兴趣.我见过的大多数示例都具有注销功能重定向到主页的功能.有什么理由不留在同一页面上吗?

I'M ALSO INTERESTED if you think this is bad practice from a usability standpoint. Most examples I've seen have the logout function redirect to the home page. Is there any reason NOT to stay on the same page?

推荐答案

尝试失败: 返回Redirect :: back(); 在您的登出路线/控制器中?

Die you try: return Redirect::back(); In your logout route/controller?

这篇关于在Laravel注销后如何保持在同一页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆