Files
EasyAdmin8/app/admin/model/SystemAdmin.php
wolfcode 652b17d6a6 refactor(admin): move auth_ids explode logic to model
- Remove auth_ids explode logic from Admin controller
- Add getAuthIdsAttr method to SystemAdmin model for auth_ids parsing
- This change improves code organization and reusability
2025-03-26 10:03:59 +08:00

36 lines
679 B
PHP

<?php
namespace app\admin\model;
use app\common\model\TimeModel;
class SystemAdmin extends TimeModel
{
protected function getOptions(): array
{
return [
'deleteTime' => 'delete_time',
];
}
public array $notes = [
'login_type' => [
1 => '密码登录',
2 => '密码 + 谷歌验证码登录'
],
];
public function getAuthIdsAttr($value): array
{
if (!$value) return [];
return explode(',', $value);
}
public function getAuthList(): array
{
return (new SystemAuth())->removeOption('where')->where('status', 1)->column('title', 'id');
}
}