承接 vassilidev/laraperm 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vassilidev/laraperm

最新稳定版本:v1.1.1

Composer 安装命令:

composer require vassilidev/laraperm

包简介

Create and manage permission and roles for your user !

README 文档

README

Latest Version on Packagist Total Downloads

Installation

You can install the package via composer:

composer require vassilidev/laraperm

You can publish config and run the migrations with:

php artisan vendor:publish --provider="Vassilidev\Laraperm\LarapermServiceProvider"

This is the contents of the published config file:

return [
    'permissions' => [
        'super-admin' => env('LARAPERM_PERMISSION_SUPERADMIN', '*'),
    ]
];

Usage

Permission::create(['name' => 'edit posts']);

$role = Role::create(['name' => 'Publisher']);
$role->givePermissionTo('edit posts');

$user = User::factory()->create();
$publisher = User::factory()->create();

$user->declareAsSuperAdmin();
 $publisher->assignRole('Publisher');

dump($user->isSuperAdmin()); // True
dump($publisher->isSuperAdmin()); // False

dump($user->can('edit posts')); // True
dump($publisher->can('edit posts')); // True

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-08