<?php
namespace Database\Seeders;
use App\Models\Department;
use App\Models\Room;
use Illuminate\Database\Seeder;
class RoomSeeder extends Seeder { public function run(): void { $rooms = [['100 Level Geology Class','classroom',120,'Ground'],['200 Level Geology Class','classroom',100,'1st'],['300 Level Geology Class','classroom',80,'1st'],['400 Level Geology Class','classroom',60,'2nd'],['PG Geology Class','classroom',40,'2nd'],['Economic Geology Laboratory','laboratory',30,'Ground'],['Geology Research Laboratory','laboratory',20,'1st'],['Petrology / Mineral Laboratory','laboratory',25,'1st'],['Sedimentology / Thin Section Lab','laboratory',20,'2nd'],['Geochemistry Laboratory','laboratory',18,'2nd'],['Paleontology Laboratory','laboratory',22,'3rd'],['Geology Seminar Room','seminar',50,'3rd']]; $department = Department::where('name', 'Geology')->firstOrFail(); foreach ($rooms as [$name,$type,$capacity,$floor]) Room::firstOrCreate(['name' => $name], ['department_id' => $department->id, 'room_type' => $type, 'capacity' => $capacity, 'floor' => $floor]); } }
