feat: add some fields to product

This commit is contained in:
2026-06-18 12:46:37 +03:30
parent 7afceffdd3
commit 4185113091
3 changed files with 81 additions and 5 deletions
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('products', function (Blueprint $table) {
// Display-only text fields (no calculation, just shown in the UI)
$table->string('discounted_price')->nullable()->after('descriptions'); // قیمت کلی تخفیف خورده
$table->string('daily_price')->nullable()->after('discounted_price'); // قیمت روزانه
$table->string('discount')->nullable()->after('daily_price'); // تخفیف
// Best-seller flag (only one per package should be active)
$table->boolean('is_best_seller')->default(false)->after('discount'); // پرفروش‌ترین
// Display order (lower = shown higher, 0 is top)
$table->unsignedInteger('sort_order')->default(0)->after('is_best_seller'); // ترتیب
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('products', function (Blueprint $table) {
$table->dropColumn([
'discounted_price',
'daily_price',
'discount',
'is_best_seller',
'sort_order',
]);
});
}
};