Add 'Unassigned' room creation for unassigned auditions when the unassigned room does not exist.

This commit is contained in:
Matt Young 2025-06-11 07:55:15 -05:00
parent 4766141a2c
commit 551f04588c
1 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,16 @@ class RoomController extends Controller
abort(403);
}
$rooms = Room::with('auditions.entries', 'entries')->orderBy('name')->get();
if (! $rooms->contains('id', 0)) {
$unassignedRoom = Room::create([
'id' => 0,
'name' => 'Unassigned',
'description' => 'Auditions that have not been assigned to a room',
]);
$unassignedRoom->id = 0;
$unassignedRoom->save();
$rooms = Room::with('auditions.entries', 'entries')->orderBy('name')->get();
}
return view('admin.rooms.index', ['rooms' => $rooms]);
}