feat(权限): 安装和配置 Spatie Permission 包

- 安装 spatie/laravel-permission 包(v6.24.1)
- 发布配置文件和迁移文件
- 运行迁移创建权限表
- 在 User 模型中添加 HasRoles trait
- 添加 isSuperAdmin 和 isAdmin 辅助方法
- 创建 PermissionSeeder 定义 45 个权限
- 创建 3 个预设角色(super-admin、admin、user)
- 为角色分配相应权限
- 为第一个用户分配超级管理员角色
This commit is contained in:
2026-03-11 09:55:40 +08:00
parent 7a4fa7cc18
commit 7d13a560f3
9 changed files with 1042 additions and 129 deletions

View File

@@ -18,7 +18,8 @@
"maatwebsite/excel": "^3.1",
"meilisearch/meilisearch-php": "^1.16",
"phpoffice/phpword": "^1.4",
"spatie/laravel-activitylog": "^4.12"
"spatie/laravel-activitylog": "^4.12",
"spatie/laravel-permission": "^6.24"
},
"require-dev": {
"fakerphp/faker": "^1.23",