Laravel-从控制台命令杀死会话和Cookie? [英] Laravel - kill session and cookie from console command?
问题描述
在Laravel控制台命令中,是否有任何方法可以清除会话和/或记住我的Cookie"?
Is there any way, within a Laravel console command, to clear the session and/or the remember me cookie?
控制台命令旨在停用用户,因此,如果用户在登录时被停用,我希望他们自动注销.
The console command is designed to deactivate users, and so if a user is deactivated while they are logged in, I want them to automatically be logged out.
但是我不确定这是否可能.想法?
But I'm not sure this is possible. Ideas?
推荐答案
您为什么不尝试这种方法呢? https://laracasts. com/discuss/channels/laravel/middleware-where-user-status-is-active?page = 1
Instead of that why don't you try this approach? https://laracasts.com/discuss/channels/laravel/middleware-where-user-status-is-not-active?page=1
基本上,有一个中间件来检查当前用户是否处于活动状态,如果不是,则将其重定向到登录名
basicly, have a middleware that checks if the current user is active, in case it is not, redirect him to login
这篇关于Laravel-从控制台命令杀死会话和Cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!