|
|
||
|---|---|---|
| database | ||
| lang | ||
| routes | ||
| src | ||
| .gitignore | ||
| README.md | ||
| composer.json | ||
README.md
Dcat Admin Extension
用户管理
安装
- 进入项目目录
mkdir packages && cd packagesgit clone https://gitea.peidikeji.cn/pdkj/dcat-admin-user.gitcomposer config repositories.peidikeji/dcat-admin-user path ./packages/dcat-admin-usercomposer require peidikeji/dcat-admin-userphp artisan migrate
事件
- 用户注册成功:
Peidikeji\User\Events\UserRegister
测试数据
- 复制文件:
database/factories/UserFactory,database/seeders/UserSeeder
后台权限
$permissions = [
'users' => ['name' => '用户管理', 'curd' => true],
];
后台菜单
$menus = [
['title' => '用户模块', 'icon' => 'feather icon-user', 'uri' => '/users', 'permission' => 'users', 'children' => [
['title' => '用户管理', 'icon' => '', 'uri' => '/users', 'permission' => 'users']
]],
];
数据表
用户表: users
| column | type | nullable | default | comment |
|---|---|---|---|---|
| id | bigint | not null | - | 主键 |
| username | varchar(191) | null | - | 用户名 |
| phone | varchar(191) | null | - | 手机号 |
| name | varchar(191) | null | - | 昵称 |
| avatar | varchar(191) | null | - | 头像 |
| balance | decimal(12, 2) | not null | 0 | 余额 |
| invite_code | varchar(191) | not null | - | 邀请码 |
| inviter_id | bigint | null | - | 邀请人 |
| inviter_path | varchart(191) | not null | '-' | 所有的上级邀请人(-1-2-3-) |
| created_at | timestamp | null | - | 创建时间 |
| updated_at | timestamp | null | - | 更新时间 |
第三方登录信息: user_socialites
| column | type | nullable | default | comment |
|---|---|---|---|---|
| id | bigint | not null | - | 主键 |
| user_id | bigint | not null | - | 外键关联 users.id |
| type | varchar(191) | not null | - | 类型(SocialiteType) |
| openid | varchar(191) | not null | - | 第三方唯一凭证 |
| unionid | varchar(191) | null | - | 第三方唯一凭证 |
| data | json | null | - | 第三方数据 |
| created_at | timestamp | null | - | 创建时间 |
| updated_at | timestamp | null | - | 更新时间 |
用户余额变动记录: user_balance_logs
| column | type | nullable | default | comment |
|---|---|---|---|---|
| id | bigint | not null | - | 主键 |
| user_id | bigint | not null | - | 外键关联 users.id |
| cate | varchar(191) | not null | - | 类别 |
| description | varchar(191) | not null | - | 描述 |
| amount | decimal(12, 2) | not null | - | 变动数量(正数为增加, 负数为减少) |
| balance | decimal(12, 2) | not null | - | 变动后的余额 |
| remarks | varchart(191) | null | - | 备注 |
| source_type | varchart(191) | null | - | 来源(多态关联) |
| source_id | bigint | null | - | 来源(多态关联) |
| created_at | timestamp | null | - | 创建时间 |
| updated_at | timestamp | null | - | 更新时间 |