Unassigned now working, but showing an extra column

This commit is contained in:
Matt Young 2024-06-04 16:14:53 -05:00
parent 1b0112b73f
commit 38ead6f3eb
2 changed files with 33 additions and 1 deletions

View File

@ -13,8 +13,8 @@ class RoomController extends Controller
public function index() public function index()
{ {
if(! Auth::user()->is_admin) abort(403); if(! Auth::user()->is_admin) abort(403);
$unassignedAuditions = Audition::with('entries')->where('room_id','=','0')->orderBy('score_order')->get();
$rooms = Room::with('auditions.entries')->orderBy('name')->get(); $rooms = Room::with('auditions.entries')->orderBy('name')->get();
$unassignedAuditions = Audition::with('entries')->whereNull('room_id')->orderBy('score_order')->get();
return view('admin.rooms.index', ['rooms' => $rooms, 'unassignedAuditions' => $unassignedAuditions]); return view('admin.rooms.index', ['rooms' => $rooms, 'unassignedAuditions' => $unassignedAuditions]);
} }
} }

View File

@ -0,0 +1,32 @@
<?php
use App\Models\Room;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Room::upsert([
'id' => 0,
'name' => 'Unassigned',
'description' => 'These auditions have no room',
],
uniqueBy: ['id'],
update: ['name','description']
);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};