id(); $table->foreignId('tenant_id')->constrained()->restrictOnDelete(); $table->foreignId('invoice_id')->constrained()->restrictOnDelete(); $table->foreignId('supplier_bank_detail_id')->constrained()->restrictOnDelete(); $table->foreignId('created_by')->constrained('users')->restrictOnDelete(); $table->foreignId('reviewed_by')->nullable()->constrained('users')->restrictOnDelete(); $table->string('status')->default('pending'); $table->bigInteger('amount_minor'); $table->string('currency', 3); $table->date('paid_on'); $table->text('external_reference'); $table->string('reference_hash', 64); $table->string('payload_hash', 64); $table->text('evidence_reference'); $table->text('bank_snapshot'); $table->text('review_reason')->nullable(); $table->timestamp('reviewed_at')->nullable(); $table->timestamps(); $table->unique(['tenant_id', 'reference_hash']); }); } public function down(): void { throw new LogicException('Preservar registos e conferĂȘncias de pagamentos externos.'); } };