// database/migrations/xxxx_create_orders_table.php public function up() { Schema::create('orders', function (Blueprint $table) { $table->id(); $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); $table->string('order_number')->unique(); $table->decimal('subtotal', 10, 2); $table->decimal('discount', 10, 2)->default(0); $table->decimal('shipping', 10, 2)->default(0); $table->decimal('total', 10, 2); $table->string('coupon_code')->nullable(); $table->string('payment_method'); $table->string('payment_status')->default('pending'); $table->string('order_status')->default('pending'); $table->text('shipping_address'); $table->text('billing_address'); $table->string('tracking_number')->nullable(); $table->timestamps(); }); }