?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('ticket_replies', function (Blueprint $table) { $table->id(); $table->foreignId('ticket_id')->constrained()->cascadeOnDelete()->index(); $table->foreignId('author_user_id')->nullable()->constrained('users')->nullOnDelete(); $table->string('author_type')->default('staff'); // staff|customer|system $table->text('body'); $table->string('visibility')->default('public'); // public|internal $table->json('attachments')->nullable(); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('ticket_replies'); } };