[英]How to distinguish admin from users
I want to know how should I distinguish admin from others users not by database but by other ways (like sessions). 我想知道如何将管理员与其他用户(不是通过数据库而是通过其他方式(例如会话))区分开来。
I think I should use a middlleware in URLs which contain "admin" or "staff". 我认为我应该在包含“ admin”或“ staff”的URL中使用中间件。 How to route it and how to handle the middelware? 如何路由以及如何处理中间件?
You could use Laravel Permission (or something similar) which lets you manage user permissions and roles in a database. 您可以使用Laravel权限 (或类似的权限 )来管理数据库中的用户权限和角色。
Alternatively, you could create your own system by... 或者,您可以通过以下方式创建自己的系统:
I would avoid methods without databases if possible for security concerns. 如果出于安全考虑,我会避免没有数据库的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.