简体   繁体   English

使用 jetstream 的 Laravel 8 用户角色和权限

[英]Laravel 8 User roles & Permissions using jetstream

I am working on a project on laravel 8.我正在 Laravel 8 上开展一个项目。
I am a newbie.我是新手。 Learning and developing a live web application at the same time.同时学习和开发实时网络应用程序。

I have used jetstream for authentication.我已经使用 jetstream 进行身份验证。 And following that, i have built my other modules.之后,我构建了我的其他模块。

Now i want to develop the user management.现在我想开发用户管理。 Where i Can create user roles and assign them permissions.我可以在哪里创建用户角色并为其分配权限。 Also, apart from role based permissions, there should be permissions overrides to be applied to each user.此外,除了基于角色的权限之外,还应该对每个用户应用权限覆盖。

I have checked online tutorials on user roles and permissions with a package called spatie.我已经使用名为 spatie 的包检查了有关用户角色和权限的在线教程。

My questions are:我的问题是:

  1. Can i add the user roles and permissions to already existing project?我可以将用户角色和权限添加到现有项目吗? (Asking this because i see the tutorials mentioning to have a fresh install of laravel) (问这个是因为我看到教程提到要全新安装laravel)
  2. Can spatie be used along with jetstream? spatie 可以与 jetstream 一起使用吗? (There are certain articles which points compatiblity & other issues it creates) (有些文章指出了兼容性和它造成的其他问题)

Highly appreciate any pointers to help me go ahead with this.非常感谢任何帮助我继续进行的指示。

Thanks in advance.提前致谢。

  1. yes you can use roles & permission for an existing project.是的,您可以对现有项目使用角色和权限。 add table for role, & make a table where you can store the permissions for the role.为角色添加表,并创建一个表,您可以在其中存储角色的权限。 make the relation between them.建立它们之间的关系。 implement these on the model where you need them.在您需要它们的模型上实现这些。

  2. Yes.是的。 Spatie Can be used along with jetstream. Spatie 可与 jetstream 一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM