added merge wallet 6

This commit is contained in:
2026-06-10 20:53:18 +03:30
parent 85988bc212
commit 3be53b599b
24 changed files with 1601 additions and 744 deletions
View File
@@ -1,43 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('fname',100)->nullable();
$table->string('lname',100)->nullable();
$table->string('name',200)->nullable();
$table->boolean('active')->default(true);
$table->string('mobile',20)->nullable();
$table->integer('avatar_id')->nullable()->unsigned();
$table->timestamp('last_seen_at')->nullable();
$table->tinyInteger('sts')->nullable()->unsigned();
$table->integer('user_type')->nullable()->unsigned();
$table->string('token_sms',10)->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
@@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}
@@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}
@@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePersonalAccessTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
}
}
@@ -1,55 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCustomersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->string('fname',100)->nullable();
$table->string('lname',100)->nullable();
$table->string('name',200)->nullable();
$table->boolean('active')->default(true);
$table->string('mobile',20)->nullable();
$table->integer('avatar_id')->nullable()->unsigned();
$table->timestamp('last_seen_at')->nullable();
$table->integer('default_address_id')->nullable()->unsigned();
$table->tinyInteger('sts')->nullable()->unsigned();
$table->tinyInteger('type')->default(1);
$table->integer('total_transaction')->default(0);
$table->string('token_sms',10)->nullable();
$table->string('password')->nullable();
$table->integer('orders_count')->default(0);
$table->timestamp('birth_date')->nullable();
$table->string('shop_name',100)->nullable();
$table->string('phone_number',20)->nullable();
$table->string('city',50)->nullable();
$table->string('province',50)->nullable();
$table->string('n_code',20)->nullable();
$table->boolean('is_archive')->default(0);
$table->boolean('trade_active')->default(0);
$table->integer('gram')->default(0);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('customers');
}
}
@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateConst extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('const', function (Blueprint $table) {
$table->id();
$table->string('key',50)->nullable();
$table->string('title_fa',50)->nullable();
$table->string('value',100)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('const');
}
}
@@ -1,46 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateOrdersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('orders', function (Blueprint $table) {
$table->id();
$table->integer('customer_id')->nullable()->unsigned();
$table->tinyInteger('sts')->nullable()->unsigned();
$table->tinyInteger('direction')->nullable()->unsigned();
$table->tinyInteger('payment_sts')->nullable()->unsigned();
$table->tinyInteger('type')->default(1);
$table->double('amount',15,6)->nullable()->unsigned();
$table->integer('total_fee')->nullable()->unsigned();
$table->integer('price')->nullable()->unsigned();
$table->integer('price_original')->nullable()->unsigned();
$table->integer('total_price')->nullable()->unsigned();
$table->integer('total_price_original')->nullable()->unsigned();
$table->integer('fee')->nullable()->unsigned();
$table->integer('payment_remind')->nullable()->unsigned();
$table->integer('payment_amount')->nullable()->unsigned();
$table->string('description',1024)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('orders');
}
}
@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePricesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('prices', function (Blueprint $table) {
$table->id();
$table->integer('price')->nullable()->unsigned();
$table->date('date_at')->nullable();
$table->time('time_at')->nullable();
$table->integer('user_id')->nullable()->unsigned();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('prices');
}
}
@@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePriceCandlesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('price_candles', function (Blueprint $table) {
$table->id();
$table->integer('start')->nullable()->unsigned();
$table->integer('end')->nullable()->unsigned();
$table->integer('high')->nullable()->unsigned();
$table->integer('low')->nullable()->unsigned();
$table->date('date_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('price_candles');
}
}
@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('logs', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->unsigned()->nullable();
$table->integer('customer_id')->unsigned()->nullable();
$table->string('data',1024)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('logs');
}
}
@@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFundsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('funds', function (Blueprint $table) {
$table->id();
$table->string('title',100)->nullable();
$table->integer('file_id')->nullable()->unsigned();
$table->integer('customer_id')->nullable()->unsigned();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('funds');
}
}
@@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWithdrawsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('withdraws', function (Blueprint $table) {
$table->id();
$table->integer('customer_id')->unsigned()->nullable();
$table->integer('user_id')->unsigned()->nullable();
$table->bigInteger('cash')->unsigned()->nullable();
$table->double('gold')->unsigned()->nullable();
$table->string('tracked_number',50)->nullable();
$table->timestamp('date_at')->nullable();
$table->tinyInteger('sts')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('withdraws');
}
}
@@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBankAccountsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bank_accounts', function (Blueprint $table) {
$table->id();
$table->integer('customer_id')->nullable()->unsigned();
$table->string('cart_number')->nullable();
$table->string('shaba_number')->nullable();
$table->string('bank_name')->nullable();
$table->string('account_number')->nullable();
$table->tinyInteger('sts')->default(1);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('bank_accounts');
}
}
@@ -1,44 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddProviderFieldsToOrdersTable extends Migration
{
public function up()
{
if (!Schema::hasColumn('orders', 'provider_id')) {
Schema::table('orders', function (Blueprint $table) {
$table->unsignedBigInteger('provider_id')
->nullable()
->after('id')
->index();
});
}
if (!Schema::hasColumn('orders', 'total_price_montzar')) {
Schema::table('orders', function (Blueprint $table) {
$table->decimal('total_price_montzar', 20, 4)
->nullable()
->after('total_price');
});
}
}
public function down()
{
if (Schema::hasColumn('orders', 'total_price_montzar')) {
Schema::table('orders', function (Blueprint $table) {
$table->dropColumn('total_price_montzar');
});
}
if (Schema::hasColumn('orders', 'provider_id')) {
Schema::table('orders', function (Blueprint $table) {
$table->dropIndex(['provider_id']);
$table->dropColumn('provider_id');
});
}
}
}
@@ -1,34 +0,0 @@
<?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('products')) {
return;
}
Schema::table('products', function (Blueprint $table) {
if (!Schema::hasColumn('products', 'price_offset_percent')) {
$table->decimal('price_offset_percent', 8, 2)->default(0)->after('price_profit');
}
});
}
public function down(): void
{
if (!Schema::hasTable('products')) {
return;
}
if (Schema::hasColumn('products', 'price_offset_percent')) {
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('price_offset_percent');
});
}
}
};
@@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTotalReferralsToCustomersTable extends Migration
{
public function up()
{
if (Schema::hasColumn('customers', 'total_referrals')) {
return;
}
Schema::table('customers', function (Blueprint $table) {
$table->unsignedInteger('total_referrals')->default(0)->after('referral_to_id');
});
}
public function down()
{
if (!Schema::hasColumn('customers', 'total_referrals')) {
return;
}
Schema::table('customers', function (Blueprint $table) {
$table->dropColumn('total_referrals');
});
}
}
@@ -1,17 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class AlterLogsDataToLongtext extends Migration
{
public function up()
{
DB::statement('ALTER TABLE `logs` MODIFY COLUMN `data` LONGTEXT NULL');
}
public function down()
{
DB::statement('ALTER TABLE `logs` MODIFY COLUMN `data` VARCHAR(1024) NULL');
}
}
@@ -1,43 +0,0 @@
<?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('products')) {
return;
}
Schema::table('products', function (Blueprint $table) {
if (!Schema::hasColumn('products', 'order_limit_enabled')) {
$table->boolean('order_limit_enabled')->default(false)->after('percent_fee_buy');
}
if (!Schema::hasColumn('products', 'min_order_cash')) {
$table->unsignedBigInteger('min_order_cash')->nullable()->after('order_limit_enabled');
}
if (!Schema::hasColumn('products', 'max_order_cash')) {
$table->unsignedBigInteger('max_order_cash')->nullable()->after('min_order_cash');
}
});
}
public function down(): void
{
if (!Schema::hasTable('products')) {
return;
}
Schema::table('products', function (Blueprint $table) {
$columns = ['order_limit_enabled', 'min_order_cash', 'max_order_cash'];
foreach ($columns as $column) {
if (Schema::hasColumn('products', $column)) {
$table->dropColumn($column);
}
}
});
}
};
@@ -1,42 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (!Schema::hasTable('products')) {
return;
}
if (!Schema::hasColumn('products', 'show_in_assets')) {
Schema::table('products', function (Blueprint $table) {
if (Schema::hasColumn('products', 'show')) {
$table->boolean('show_in_assets')->default(false)->after('show');
} else {
$table->boolean('show_in_assets')->default(false);
}
});
} else {
DB::statement(
'ALTER TABLE `products` MODIFY COLUMN `show_in_assets` TINYINT(1) NOT NULL DEFAULT 0'
);
DB::table('products')->update(['show_in_assets' => 0]);
}
}
public function down(): void
{
if (!Schema::hasTable('products') || !Schema::hasColumn('products', 'show_in_assets')) {
return;
}
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('show_in_assets');
});
}
};
@@ -1,36 +0,0 @@
<?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('products')) {
return;
}
if (!Schema::hasColumn('products', 'use_last_price_if_zero')) {
Schema::table('products', function (Blueprint $table) {
if (Schema::hasColumn('products', 'show_in_assets')) {
$table->boolean('use_last_price_if_zero')->default(false)->after('show_in_assets');
} else {
$table->boolean('use_last_price_if_zero')->default(false);
}
});
}
}
public function down(): void
{
if (!Schema::hasTable('products') || !Schema::hasColumn('products', 'use_last_price_if_zero')) {
return;
}
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('use_last_price_if_zero');
});
}
};