bfe/laravel-permission
最新稳定版本:0.0.1
Composer 安装命令:
composer require bfe/laravel-permission
包简介
Permission handling for Laravel 6.0 and up
README 文档
README
Documentation, Installation, and Usage Instructions
To get started with using the package, we'll install it using the following command:
composer require bfe/laravel-permission
Now that we've installed the package, we'll need to publish the database migration and config file:
php artisan vendor:publish --provider="Bfe\Permission\PermissionServiceProvider"
We can now run the migrations to create the new tables in our database:
php artisan migrate
Assuming that we are using the default config values and haven't changed anything in the package's config/permission.php, we should now have five new tables in our database:
What It Does
This package allows you to manage user permissions and roles in a database.
Once installed you can do stuff like this:
// Adding permissions to a user $user->givePermissionTo('edit articles'); // Adding permissions via a role $user->assignRole('writer'); $role->givePermissionTo('edit articles');
Because all permissions will be registered on Laravel's gate, you can check if a user has a permission with Laravel's default can function:
$user->can('edit articles');
Testing
composer test
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-21