fix logic and tests, update docker CI file
This commit is contained in:
@@ -69,16 +69,20 @@ class IncidentLookupService
|
||||
}
|
||||
|
||||
$rows = DB::table('users')
|
||||
->select('id, firstname, lastname')
|
||||
->select('id', 'firstname', 'lastname')
|
||||
->whereIn('id', $userIds)
|
||||
->get()
|
||||
->map(fn ($row) => (array) $row)
|
||||
->map(fn ($row) => $row instanceof \Illuminate\Contracts\Support\Arrayable ? $row->toArray() : (array) $row)
|
||||
->all();
|
||||
|
||||
$map = [];
|
||||
foreach ($rows as $row) {
|
||||
$id = $row['id'] ?? $row['user_id'] ?? null;
|
||||
if ($id === null) {
|
||||
continue;
|
||||
}
|
||||
$name = trim((string) ($row['firstname'] ?? '') . ' ' . (string) ($row['lastname'] ?? ''));
|
||||
$map[(int) $row['id']] = $name !== '' ? $name : ('User #' . $row['id']);
|
||||
$map[(int) $id] = $name !== '' ? $name : ('User #' . $id);
|
||||
}
|
||||
|
||||
return $map;
|
||||
|
||||
Reference in New Issue
Block a user