简体   繁体   English

我收到一个角色的 ID,并使用该 ID 列出分配给该角色的所有权限

[英]I receive an id of a Role and with that id I list all the permissions that are assigned to that role

Good Evening, it is possible that in SPATIE-LARAVEL-PERMISSION the following:晚上好,在 SPATIE-LARAVEL-PERMISSION 中可能会出现以下情况:

Some function or way that I receive an id of a Role and with that id I list all the permissions that are assigned to that role.一些 function 或我收到角色 id 的方式,并使用该 id 列出分配给该角色的所有权限。 I'm looking but I didn't find an answer.我正在寻找,但我没有找到答案。 sorry for the inconvenience thank you很抱歉给您带来不便谢谢

As described here in the docs, you can get all permissions of a role with the permissions relation如文档中所述您可以通过permissions关系获取角色的所有权限

use \Spatie\Permission\Models\Role;

Role::find($id)->permissions;

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

相关问题 我如何从此数组中获取role_id - How can i get role_id from this array Laravel Spatie 权限 - 用户和角色关系仅获取 id 和名称 - Laravel Spatie Permissions - user and role relation get only id and name Laravel 6:如何将 user_id 和 role_id(s) 发送到控制器,以同步 user_role 数据透视表? - Laravel 6: how do I send user_id with role_id(s) to controller, in order to sync user_role pivot table? 角色和归因ID - Role and Attribution ID laravel-如何使用zizaco在5.1中的orm中获得具有所有角色和所有权限的用户? - laravel- how can i get a user with all roles and all permissions with per role in orm in 5.1 with zizaco? 如何使用附加 function 将用户 ID 和角色 ID 附加到 laravel 中的 pivot 表? - How can I attach the user id and role id to the pivot table in laravel using attach function? Spatie Laravel Jetstream 中的 id '#' 没有角色 - There is no role in id '#' in Spatie Laravel Jetstream 如何检查分配给另一个角色的同一组权限? - How to check same set of permissions assigned to another role? Laravel Entrust->获得角色的所有权限? - Laravel Entrust -> get all Permissions for a role? 如何根据laravel 8中自定义中间件中的role_id分配权限和项目? - how to assign permissions and items according to role_id in custom middleware in laravel 8?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM