- 在多个控制器中更新权限检查逻辑,确保管理员能够更灵活地管理代理和玩家。 - 在 AdminPlayerStoreController 中引入对玩家创建能力的验证,确保只有具备相应权限的管理员能够创建玩家。 - 更新请求验证逻辑,新增 credit_limit、rebate_rate 和 extra_rebate_rate 字段,以支持更细粒度的玩家管理。 - 在 AgentNodeProfileController 中添加对父代理能力授予的验证,确保子代理的权限在父代理范围内。 - 引入 AgentProfileFieldRules 以简化代理资料更新请求的规则定义,提升代码复用性。
50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
||
|
||
namespace Database\Seeders;
|
||
|
||
use App\Models\AdminUser;
|
||
use Illuminate\Database\Seeder;
|
||
use App\Support\AdminAgentPermissionMenuActionSync;
|
||
use App\Support\AdminDrawPermissionMenuActionSync;
|
||
use App\Support\PlatformSystemRoles;
|
||
|
||
/**
|
||
* 后台 RBAC:平台固定角色 super_admin / agent。
|
||
*
|
||
* 演示账号 **admin** / **123456**(仅限非 production)。
|
||
*/
|
||
final class AdminRbacAndUserSeeder extends Seeder
|
||
{
|
||
public function run(): void
|
||
{
|
||
AdminAgentPermissionMenuActionSync::syncMissing();
|
||
AdminDrawPermissionMenuActionSync::syncMissing();
|
||
|
||
PlatformSystemRoles::ensureAll();
|
||
|
||
$super = PlatformSystemRoles::ensureSuperAdminRole();
|
||
|
||
$username = 'admin';
|
||
AdminUser::query()->updateOrCreate(
|
||
['username' => $username],
|
||
[
|
||
'name' => '超级管理员',
|
||
'email' => null,
|
||
'password' => '123456',
|
||
'status' => 0,
|
||
],
|
||
);
|
||
|
||
/** @var AdminUser $admin */
|
||
$admin = AdminUser::query()->where('username', $username)->firstOrFail();
|
||
$siteId = AdminUser::defaultAdminSiteId();
|
||
$superId = (int) $super->getKey();
|
||
$admin->roles()->sync([
|
||
$superId => [
|
||
'site_id' => $siteId,
|
||
'granted_at' => now(),
|
||
],
|
||
]);
|
||
}
|
||
}
|