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