fix tests
This commit is contained in:
@@ -11,11 +11,12 @@ class MessageQueryService
|
||||
public function getUserRoleName(int $userId): ?string
|
||||
{
|
||||
$user = User::query()->with('roles')->find($userId);
|
||||
if (!$user) {
|
||||
if (! $user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$role = $user->roles->sortBy('id')->first();
|
||||
|
||||
return $role ? (string) $role->name : null;
|
||||
}
|
||||
|
||||
@@ -67,7 +68,7 @@ class MessageQueryService
|
||||
->pluck('id')
|
||||
->all();
|
||||
|
||||
if (!empty($ids)) {
|
||||
if (! empty($ids)) {
|
||||
Message::query()
|
||||
->whereIn('id', $ids)
|
||||
->update([
|
||||
@@ -90,7 +91,7 @@ class MessageQueryService
|
||||
{
|
||||
$query = Message::query()->with(['sender', 'recipient']);
|
||||
|
||||
if (!empty($filters['priority'])) {
|
||||
if (! empty($filters['priority'])) {
|
||||
$query->where('priority', $filters['priority']);
|
||||
}
|
||||
|
||||
@@ -98,8 +99,8 @@ class MessageQueryService
|
||||
$query->where('read_status', (int) $filters['read_status']);
|
||||
}
|
||||
|
||||
if (!empty($filters['search'])) {
|
||||
$term = '%' . $filters['search'] . '%';
|
||||
if (! empty($filters['search'])) {
|
||||
$term = '%'.$filters['search'].'%';
|
||||
$query->where(function ($q) use ($term) {
|
||||
$q->where('subject', 'like', $term)
|
||||
->orWhere('message', 'like', $term);
|
||||
|
||||
Reference in New Issue
Block a user