Add 'Unassigned' room creation for unassigned auditions when the unassigned room does not exist.
This commit is contained in:
parent
4766141a2c
commit
551f04588c
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue