Schema::create('orders', function (Blueprint $table) { $table->id(); $table->string('order_number')->unique(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->foreignId('customer_address_id') ->constrained() ->cascadeOnDelete(); $table->foreignId('delivery_slot_id') ->nullable() ->constrained() ->nullOnDelete(); $table->foreignId('delivery_agent_id') ->nullable() ->constrained() ->nullOnDelete(); $table->enum('status', [ 'pending', 'confirmed', 'processing', 'out_for_delivery', 'delivered', 'cancelled' ])->default('pending'); $table->enum('payment_method', [ 'online', 'cod' ]); $table->enum('payment_status', [ 'pending', 'paid', 'failed' ])->default('pending'); $table->decimal('subtotal', 10, 2); $table->decimal('tax_amount', 10, 2)->default(0); $table->decimal('delivery_charge', 10, 2)->default(0); $table->decimal('discount_amount', 10, 2)->default(0); $table->decimal('total_amount', 10, 2); $table->decimal('delivery_distance_km', 8, 2) ->nullable(); $table->text('notes')->nullable(); $table->timestamp('confirmed_at')->nullable(); $table->timestamp('out_for_delivery_at')->nullable(); $table->timestamp('delivered_at')->nullable(); $table->timestamp('cancelled_at')->nullable(); $table->timestamps(); }); Schema::create('order_items', function (Blueprint $table) { $table->id(); $table->foreignId('order_id')->constrained()->cascadeOnDelete(); $table->foreignId('product_id')->constrained()->cascadeOnDelete(); $table->foreignId('product_variant_id')->nullable() ->constrained() ->nullOnDelete(); $table->string('product_name'); $table->string('variant_name')->nullable(); $table->decimal('price', 10, 2); $table->integer('quantity'); $table->decimal('total', 10, 2); $table->timestamps(); }); Schema::create('order_status_histories', function (Blueprint $table) { $table->id(); $table->foreignId('order_id')->constrained()->cascadeOnDelete(); $table->string('status'); $table->text('remarks')->nullable(); $table->foreignId('updated_by_admin_id')->nullable(); $table->timestamps(); }); Schema::create('delivery_proofs', function (Blueprint $table) { $table->id(); $table->foreignId('order_id')->constrained()->cascadeOnDelete(); $table->foreignId('delivery_agent_id') ->constrained() ->cascadeOnDelete(); $table->string('image'); $table->text('notes')->nullable(); $table->timestamp('uploaded_at')->nullable(); $table->timestamps(); }); Schema::create('payments', function (Blueprint $table) { $table->id(); $table->foreignId('order_id')->constrained()->cascadeOnDelete(); $table->string('transaction_id')->nullable(); $table->string('gateway')->nullable(); $table->enum('payment_method', [ 'online', 'cod' ]); $table->enum('status', [ 'pending', 'paid', 'failed', 'refunded' ])->default('pending'); $table->decimal('amount', 10, 2); $table->json('gateway_response')->nullable(); $table->timestamp('paid_at')->nullable(); $table->timestamps(); }); Schema::create('payment_transactions', function (Blueprint $table) { $table->id(); $table->foreignId('payment_id')->constrained()->cascadeOnDelete(); $table->string('transaction_id'); $table->decimal('amount', 10, 2); $table->string('status'); $table->json('response')->nullable(); $table->timestamps(); }); Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name'); $table->string('email')->nullable()->unique(); $table->string('phone')->nullable()->unique(); $table->string('profile_image')->nullable(); $table->enum('login_provider', [ 'google', 'apple', 'phone' ])->nullable(); $table->string('provider_id')->nullable(); $table->boolean('is_phone_verified')->default(false); $table->boolean('is_active')->default(true); $table->decimal('wallet_balance', 10, 2)->default(0); $table->rememberToken(); $table->timestamps(); $table->softDeletes(); }); Schema::create('customer_addresses', function (Blueprint $table) { $table->id(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->string('name'); $table->string('phone'); $table->text('address'); $table->string('landmark')->nullable(); $table->string('city'); $table->string('state'); $table->string('country')->default('India'); $table->string('pincode'); $table->decimal('latitude', 10, 7); $table->decimal('longitude', 10, 7); $table->boolean('is_default')->default(false); $table->timestamps(); }); Schema::create('coupons', function (Blueprint $table) { $table->id(); $table->string('code')->unique(); $table->enum('discount_type', [ 'percentage', 'fixed', 'bogo' ]); $table->decimal('discount_value', 10, 2); $table->decimal('minimum_order_amount', 10, 2) ->default(0); $table->integer('usage_limit')->nullable(); $table->integer('used_count')->default(0); $table->timestamp('expires_at')->nullable(); $table->boolean('is_active')->default(true); $table->timestamps(); }); public function up(): void { Schema::create('coupon_usages', function (Blueprint $table) { $table->id(); $table->foreignId('coupon_id')->constrained()->cascadeOnDelete(); $table->foreignId('user_id')->constrained()->cascadeOnDelete(); $table->foreignId('order_id')->constrained()->cascadeOnDelete(); $table->timestamps(); }); } need webstetting model/migration for common websetting details including razropay details i want api for , 1. applycoupon 2. checkout page 3. add new PaymentAddress 4. place order using razropay( first create order id then place order) 5.