jobsys / permission
There is no license information available for the latest version (2.0.0) of this package.
Lite permission integrated for common project.
2.0.0
2022-12-06 09:09 UTC
Requires
- php: ^7.3|^8.0
- laravel/framework: ^9.0
This package is auto-updated.
Last update: 2025-01-06 13:34:25 UTC
README
Laravel permission
该库主要功能为拓展 User 的权限控制,包括用户组权限控制以及功能权限控制
使用方法
-
在
composer.json
中添加仓库地址{ "repositories": [ { "type": "vcs", "url": "https://gitee.com/padakeji/laravel-permission.git" } ] }
-
在项目中加入包
composer require jobsys/permission
-
执行初始化
-- 默认会执行全部初始化,如需指定某部分内加上 `tag` 选项 php artisan vendor:publish --provider="Jobsys\Permission\PermissionServiceProvider" php artisan vendor:publish --provider="Jobsys\Permission\PermissionServiceProvider" --tag="config" php artisan vendor:publish --provider="Jobsys\Permission\PermissionServiceProvider" --tag="migrations" php artisan vendor:publish --provider="Jobsys\Permission\PermissionServiceProvider" --tag="views"
-
生成数据库表
php artisan migrate
permissions
中的key
形式如api.manager.user
,api.manager.user.edit
,api.manager.user.*
, 根据项目具体情况生成插入即可
-
为 User 添加权限相关方法
class User extends Authenticatable { use HasPermissions, HasRoles; ... }
-
配置项
config/permission.php