id(); $table->foreignId('folder_id')->constrained()->cascadeOnDelete(); $table->string('type'); // invite, situation, file_request, confirmation, text $table->text('body'); $table->string('sent_by_type'); // user, client $table->unsignedBigInteger('sent_by_id'); $table->json('metadata')->nullable(); $table->timestamps(); $table->index(['folder_id', 'created_at']); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('messages'); } };