?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('payments', function (Blueprint $table) { $table->id(); $table->foreignId('invoice_id')->constrained()->cascadeOnDelete()->index(); $table->foreignId('customer_id')->constrained()->cascadeOnDelete()->index(); $table->string('gateway'); $table->string('gateway_transaction_id')->nullable(); $table->decimal('amount', 12, 4); $table->string('currency', 3)->default('USD'); $table->string('status')->default('pending')->index(); $table->string('method')->nullable(); $table->decimal('fees', 12, 4)->default(0); $table->json('meta')->nullable(); $table->timestamp('received_at')->nullable(); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('payments'); } };