feature: user list
This commit is contained in:
@@ -27,19 +27,19 @@ class UserService implements UserServiceInterface
|
||||
|
||||
public function getOtherActiveUsers(User $currentUser): Collection
|
||||
{
|
||||
return User::where('status', User::STATUS_ACTIVE)
|
||||
return User::where('status', config('constants.STATUS_ACTIVE'))
|
||||
->where('msnv', '!=', $currentUser->msnv)
|
||||
->get();
|
||||
}
|
||||
|
||||
public function sendThankcards(User $sender, string $receiverMsnv, int $amount): void
|
||||
{
|
||||
if ($sender->flag_send == User::FLAG_SEND_DISABLED) {
|
||||
if ($sender->flag_send == config('constants.FLAG_SEND_DISABLED')) {
|
||||
throw new \RuntimeException(__('messages.error.no_send_permission'));
|
||||
}
|
||||
|
||||
$receiver = User::where('msnv', $receiverMsnv)->first();
|
||||
if (!$receiver || $receiver->status != User::STATUS_ACTIVE) {
|
||||
if (!$receiver || $receiver->status != config('constants.STATUS_ACTIVE')) {
|
||||
throw new \RuntimeException(__('messages.error.receiver_invalid'));
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class UserService implements UserServiceInterface
|
||||
public function updatePassword(User $user, string $newPassword): void
|
||||
{
|
||||
$user->pass = md5($newPassword);
|
||||
$user->first_login = User::FIRST_LOGIN_FALSE;
|
||||
$user->first_login = config('constants.FIRST_LOGIN_FALSE');
|
||||
$user->save();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class UserService implements UserServiceInterface
|
||||
->sum('sent');
|
||||
|
||||
// Calculate current rank (based on received)
|
||||
$rankings = User::where('status', User::STATUS_ACTIVE)
|
||||
$rankings = User::where('status', config('constants.STATUS_ACTIVE'))
|
||||
->addSelect([
|
||||
'score' => Administration::selectRaw('COALESCE(SUM(received), 0)')
|
||||
->whereColumn('msnv', 'user.msnv')
|
||||
@@ -156,7 +156,7 @@ class UserService implements UserServiceInterface
|
||||
|
||||
$column = $type === 'sent' ? 'sent' : 'received';
|
||||
|
||||
$allActiveUsers = User::where('status', User::STATUS_ACTIVE)
|
||||
$allActiveUsers = User::where('status', config('constants.STATUS_ACTIVE'))
|
||||
->addSelect([
|
||||
'score' => Administration::selectRaw('COALESCE(SUM(' . $column . '), 0)')
|
||||
->whereColumn('msnv', 'user.msnv')
|
||||
|
||||
Reference in New Issue
Block a user