added kashkool

This commit is contained in:
2026-06-11 22:08:47 +03:30
parent 779a67a23e
commit 2d177ad581
24 changed files with 1575 additions and 3 deletions
@@ -0,0 +1,97 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (! Schema::hasTable('categories')) {
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->boolean('active')->default(true);
$table->timestamp('created_at')->nullable();
});
}
if (! Schema::hasTable('cart')) {
Schema::create('cart', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('customer_id')->nullable();
$table->unsignedTinyInteger('sts')->default(1);
$table->string('session_id')->nullable()->index();
$table->timestamps();
});
}
if (! Schema::hasTable('cart_items')) {
Schema::create('cart_items', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('cart_id');
$table->unsignedBigInteger('product_id')->nullable();
$table->unsignedInteger('quantity')->default(1);
$table->decimal('price', 15, 2)->nullable();
$table->string('title')->nullable();
$table->string('group_type')->nullable();
$table->decimal('gold_price', 15, 4)->nullable();
$table->timestamps();
});
}
if (! Schema::hasTable('pargar_reqasts')) {
Schema::create('pargar_reqasts', function (Blueprint $table) {
$table->id();
$table->string('m')->nullable();
$table->string('route')->nullable();
$table->string('ip')->nullable();
$table->json('data')->nullable();
$table->json('finance_head')->nullable();
$table->json('finance_data')->nullable();
$table->json('response')->nullable();
$table->string('function_name')->nullable();
$table->timestamps();
});
}
if (Schema::hasTable('giftcards') && ! Schema::hasColumn('giftcards', 'use_once')) {
Schema::table('giftcards', function (Blueprint $table) {
$table->unsignedTinyInteger('use_once')->default(0)->after('customer_id');
});
}
if (Schema::hasTable('giftcard_codes') && ! Schema::hasColumn('giftcard_codes', 'use_once')) {
Schema::table('giftcard_codes', function (Blueprint $table) {
$table->unsignedTinyInteger('use_once')->default(0)->after('giftcard_id');
});
}
if (Schema::hasTable('giftcard_codes') && Schema::hasColumn('giftcard_codes', 'assigned_to')) {
\Illuminate\Support\Facades\DB::statement(
'ALTER TABLE `giftcard_codes` MODIFY `assigned_to` TEXT NULL'
);
}
}
public function down(): void
{
Schema::dropIfExists('cart_items');
Schema::dropIfExists('cart');
Schema::dropIfExists('categories');
Schema::dropIfExists('pargar_reqasts');
if (Schema::hasTable('giftcards') && Schema::hasColumn('giftcards', 'use_once')) {
Schema::table('giftcards', function (Blueprint $table) {
$table->dropColumn('use_once');
});
}
if (Schema::hasTable('giftcard_codes') && Schema::hasColumn('giftcard_codes', 'use_once')) {
Schema::table('giftcard_codes', function (Blueprint $table) {
$table->dropColumn('use_once');
});
}
}
};
+2 -1
View File
@@ -14,6 +14,7 @@ INSERT INTO `migrations` (`migration`, `batch`) VALUES
('2026_06_06_000003_add_order_limit_columns_to_products_table', 1),
('2026_06_09_000001_add_show_in_assets_to_products_table', 1),
('2026_06_10_000001_add_use_last_price_if_zero_to_products_table', 1),
('2026_06_10_000002_add_type_column_to_settings_table', 1);
('2026_06_10_000002_add_type_column_to_settings_table', 1),
('2026_06_11_000001_add_store_tables_and_columns', 1);
SELECT migration, batch FROM migrations ORDER BY migration;
+5 -1
View File
@@ -179,6 +179,10 @@ INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `de
SELECT 'external_order_api_enabled', 'true', 'فعال‌سازی API سفارش خارجی (get_wallet / order)', 1, 1, 'true + node_client_id + node_shared_secret'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'external_order_api_enabled' LIMIT 1);
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
SELECT 'is_store', 'false', 'حالت فروشگاهی (قطره / کشکول)', 1, 1, 'true = روت‌های سبد خرید، دسته‌بندی، حواله، پرگار، تخفیف', 'switch'
WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'is_store' LIMIT 1);
-- Jibit
INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`)
SELECT 'jibit_verification', 'true', 'تأیید کارت بانکی با جیبیت', 1, 1, 'true/false — BankAccountController'
@@ -429,7 +433,7 @@ UPDATE `settings` SET `type` = 'switch' WHERE `key` IN (
'has_page_physical_gold', 'has_chat', 'charge_notif', 'group_sms', 'display_montzar',
'montzar_closed', 'montzar_open_buy', 'montzar_open_sell',
'product_update_price_on_list', 'product_auto_close_open_on_list', 'payping_fin_sync_enabled',
'fee_free', 'external_order_api_enabled'
'fee_free', 'external_order_api_enabled', 'is_store'
);
-- number
@@ -12,6 +12,7 @@ INSERT INTO `migrations` (`migration`, `batch`) VALUES
('2026_06_06_000003_add_order_limit_columns_to_products_table', 1),
('2026_06_09_000001_add_show_in_assets_to_products_table', 1),
('2026_06_10_000001_add_use_last_price_if_zero_to_products_table', 1),
('2026_06_10_000002_add_type_column_to_settings_table', 1);
('2026_06_10_000002_add_type_column_to_settings_table', 1),
('2026_06_11_000001_add_store_tables_and_columns', 1);
SELECT migration, batch FROM migrations ORDER BY migration;