id(); $table->string('invoice_number')->unique(); $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); $table->string('customer_name'); $table->string('customer_phone'); $table->string('customer_email'); $table->text('shipping_address'); $table->string('province'); $table->string('city'); $table->string('postal_code'); $table->decimal('subtotal', 12, 2); $table->decimal('shipping_cost', 12, 2)->default(0); $table->decimal('total_amount', 12, 2); $table->enum('payment_method', ['transfer', 'cod']); $table->enum('payment_status', ['pending', 'paid', 'failed'])->default('pending'); $table->enum('order_status', ['pending', 'processing', 'shipped', 'delivered', 'cancelled'])->default('pending'); $table->text('notes')->nullable(); $table->timestamp('paid_at')->nullable(); $table->timestamps(); $table->index(['invoice_number']); $table->index(['payment_status']); $table->index(['order_status']); }); } public function down(): void { Schema::dropIfExists('transaksis'); } };