2023_10_18_142931_create_rooms_table.php (722B)
1 <?php 2 3 use \App\Models\Cabinet; 4 use Illuminate\Database\Migrations\Migration; 5 use Illuminate\Database\Schema\Blueprint; 6 use Illuminate\Support\Facades\Schema; 7 8 return new class extends Migration { 9 /** 10 * Run the migrations. 11 */ 12 public function up(): void 13 { 14 Schema::create('rooms', function (Blueprint $table) { 15 $table->uuid('id'); 16 $table->timestamps(); 17 $table->string("name")->unique(); 18 $table->string("description"); 19 $table->foreignIdFor(Cabinet::class)->nullable($value = true); 20 }); 21 } 22 23 /** 24 * Reverse the migrations. 25 */ 26 public function down(): void 27 { 28 Schema::dropIfExists('rooms'); 29 } 30 };