<?php
 use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { public function up(): void { Schema::create('model_has_permissions', function (Blueprint $t) { $t->unsignedBigInteger('permission_id'); $t->string('model_type', 255); $t->unsignedBigInteger('model_id'); $t->index(['model_id', 'model_type'], 'model_has_permissions_model_id_model_type_index'); $t->primary(['permission_id', 'model_id', 'model_type']); $t->foreign('permission_id', 'model_has_permissions_permission_id_foreign')->references('id')->on('permissions')->onDelete('cascade'); }); } public function down(): void { Schema::dropIfExists('model_has_permissions'); } }; 