承接 ijodkor/guard 相关项目开发

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

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

ijodkor/guard

最新稳定版本:v0.0.2

Composer 安装命令:

composer require ijodkor/guard

包简介

Role, permission and action access control

README 文档

README

Role access by level, position and type

Glossaries

  • RBAC - role based access
  • LBAC - level based access (republic, province, district > ...)
  • ABAC\RABAC - (Restricted) Action based access

Installation and setup

The package will automatically register itself.

Publish migrations

php artisan vendor:publish --provider="Ijodkor\Guard\GuardServiceProvider" --tag="guard-migrations"

Adjust multischeme for project to service provider

AppServiceProvider ...

/**
* Bootstrap any application services.
*/
public function boot(): void {
    $main = database_path('migrations');
    $directories = ['public', 'users', 'rbac'];
    $paths = [];
    foreach ($directories as $directory) {
        $paths[] = database_path('migrations' . DIRECTORY_SEPARATOR . $directory);
    }

    $paths = array_merge([$main], $paths);
    $this->loadMigrationsFrom($paths);
}

And define search path of schemas to database.php

...
'pgsql' => [
    'driver' => 'pgsql',
    ....
    'search_path' => SchemeList::schemas(),
],
...

Run migration

php artisan migrate

Add seeders to Database seeder in your project

class DatabaseSeeder extends Seeder {
    /**
     * Seed the application's database.
     */
    public function run(): void {
        $this->call(UserSeeder::class);
        $this->call(RoleSeeder::class);
    }
}

Run database seeder

php artisan db:seed

Customize models

Extend user from guard user

use Ijodkor\Guard\Models\User as GuardUser;

class User extends GuardUser {

}
...

References

Links

Remainder

Add extra middleware and use this to customize built-in middleware

Illuminate Foundation abandoned, so we change use Illuminate\Foundation\Auth\User as Authenticatable in UserModel

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-05-14