mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-17 07:00:49 +08:00
medal management
This commit is contained in:
@@ -30,14 +30,15 @@ class UserRepository extends BaseRepository
|
||||
public function getDetail($id)
|
||||
{
|
||||
$with = [
|
||||
'inviter' => function ($query) {return $query->select(User::$commonFields);}
|
||||
'inviter' => function ($query) {return $query->select(User::$commonFields);},
|
||||
'valid_medals'
|
||||
];
|
||||
$user = User::query()->with($with)->findOrFail($id, User::$commonFields);
|
||||
$userResource = new UserResource($user);
|
||||
$baseInfo = $userResource->response()->getData(true)['data'];
|
||||
|
||||
$examRep = new ExamRepository();
|
||||
$examProgress = $examRep->getUserExamProgress($id, null, ['exam']);
|
||||
$examProgress = $examRep->getUserExamProgress($id, null);
|
||||
if ($examProgress) {
|
||||
$examResource = new ExamUserResource($examProgress);
|
||||
$examInfo = $examResource->response()->getData(true)['data'];
|
||||
@@ -45,6 +46,8 @@ class UserRepository extends BaseRepository
|
||||
$examInfo = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [
|
||||
'base_info' => $baseInfo,
|
||||
'exam_info' => $examInfo,
|
||||
@@ -156,4 +159,7 @@ class UserRepository extends BaseRepository
|
||||
$user = User::query()->findOrFail($id, ['modcomment']);
|
||||
return $user->modcomment;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user