id(); $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); $table->foreignId('project_id')->nullable()->constrained()->nullOnDelete(); $table->enum('type', ['incoming', 'outgoing']); $table->string('subject'); $table->text('content')->nullable(); $table->string('sender'); $table->string('recipient'); $table->date('letter_date'); $table->string('reference_number')->nullable(); $table->foreignId('parent_letter_id')->nullable()->constrained('letters')->nullOnDelete(); $table->enum('status', ['draft', 'sent', 'received', 'archived'])->default('draft'); $table->timestamps(); $table->index('tenant_id'); $table->index('project_id'); $table->index('type'); $table->index('status'); $table->index('letter_date'); }); } public function down(): void { Schema::dropIfExists('letters'); } };