Edit File: 2024_09_02_130803_create_negotiation_orders_table.php
<?php use App\Enums\NegotiationOrderStatusEnum; use App\Enums\OrderPayType; use App\Enums\OrderWhenEnum; use App\Enums\ProductDeliveryTypesEnum; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('negotiation_orders', function (Blueprint $table) { $table->id(); $table->string('order_num', 50); //! create with new order dynamic $table->foreignId('user_id')->constrained()->onDelete('cascade'); $table->foreignId('room_id')->nullable()->constrained('rooms'); $table->foreignId('provider_id')->nullable()->constrained()->onDelete('cascade'); $table->date('schedule_execution_date')->nullable(); $table->time('schedule_execution_time')->nullable(); $table->foreignId('cancellation_reason_id')->nullable()->constrained('cancel_reasons')->onDelete('cascade'); $table->foreignId('city_id')->nullable()->constrained()->onDelete('cascade'); $table->foreignId('neighborhood_id')->nullable()->constrained()->onDelete('cascade'); $table->foreignId('product_id')->nullable()->constrained()->onDelete('cascade'); $table->enum('order_type', array_column(OrderWhenEnum::cases(), 'value'))->default(OrderWhenEnum::IMMEDIATELY->value); $table->tinyInteger('receiving_method')->default(1) ->comment('Store=' . ProductDeliveryTypesEnum::Store->value, 'Home=' . ProductDeliveryTypesEnum::Home->value); $table->integer('quantity')->default(1); $table->decimal('delivery_price', 9, 2)->default(0); $table->integer('status')->default(NegotiationOrderStatusEnum::Pending->value); $table->integer('pay_type')->default(OrderPayType::UNDEFINED->value); $table->decimal('admin_commission_per_for_delegate', 9, 2)->default(0); $table->decimal('admin_commission_for_delegate', 9, 2)->default(0); $table->json('pay_data')->nullable(); $table->decimal('lat')->nullable(); $table->decimal('lng')->nullable(); $table->string('map_desc', 255)->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('negotiation_orders'); } };
Back to File Manager