mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 23:57:49 +08:00
feat : admin user finish
This commit is contained in:
18
app/Repository/AdminRoleRepository.php
Normal file
18
app/Repository/AdminRoleRepository.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* This service file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Model\AdminRole;
|
||||
|
||||
final class AdminRoleRepository extends BaseRepository
|
||||
{
|
||||
public function __construct(protected readonly AdminRole $model) {}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ declare(strict_types=1);
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Model\AdminUser;
|
||||
use Hyperf\Database\Concerns\BuildsQueries;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\Database\Model\Model;
|
||||
|
||||
/**
|
||||
* Class AdminUserRepository
|
||||
@@ -31,13 +34,4 @@ final class AdminUserRepository extends BaseRepository
|
||||
->where('username', $username)
|
||||
->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
* @return array|null
|
||||
*/
|
||||
public function findById(mixed $id): ?array
|
||||
{
|
||||
return $this->getQuery()->whereKey($id)->first()?->toArray() ?? null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user