Edit File: 2021_06_25_200904_create_users_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; use App\Enums\UserStatus; use App\Enums\ApproveStatus; use App\Enums\UserTypes; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name')->nullable(); $table->string('email')->nullable(); $table->string('country_key')->nullable(); $table->string('phone')->nullable(); $table->string('password')->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->timestamp('phone_verified_at')->nullable(); $table->string('avatar')->default('default.png'); $table->foreignId('role_id')->nullable()->constrained('roles','id')->onDelete('restrict'); $table->enum('status', [ UserStatus::BLOCK , UserStatus::PENDING, UserStatus::ACTIVE ])->default(UserStatus::PENDING,); $table->enum('approve', [ApproveStatus::PENDING, ApproveStatus::APPROVED , ApproveStatus::REFUSED ])->default(ApproveStatus::PENDING); $table->enum('type' , [UserTypes::USER , UserTypes::DELEGATE , UserTypes::COMPANY])->default(UserTypes::USER); $table->boolean('active')->default(true); $table->boolean('is_blocked')->default(false); $table->boolean('is_available')->default(true); $table->foreignId('city_id')->nullable()->constrained('cities','id')->onDelete('cascade')->onUpdate('cascade'); $table->enum('completed_info',['true','false'])->default('false'); $table->enum('show_policy',['true','false'])->default('false'); $table->enum('gender', ['male', 'female'])->nullable(); $table->string('changed_phone', 255)->unique()->nullable(); $table->string('changed_country_key', 255)->unique()->nullable(); $table->string('code', 255)->nullable(); $table->string('long', 255)->nullable(); $table->string('lat', 255)->nullable(); $table->text('address')->nullable(); $table->double('wallet')->default(0)->nullable(); $table->string('bank_account_number')->nullable(); $table->string('bank_iban_number')->nullable(); $table->string('bank_name')->nullable(); $table->string('bank_account_owner')->nullable(); $table->double('total_bills')->default(0)->nullable(); $table->double('total_delivery_fees')->default(0)->nullable(); $table->double('num_orders')->default(0)->nullable(); $table->double('num_comments')->default(0)->nullable(); $table->integer('num_rating')->default(0); $table->string('rate')->default('0.00'); $table->string('car_front')->nullable(); $table->string('driving_license')->nullable(); $table->string('car_license')->nullable(); $table->string('delegation_image')->nullable(); $table->foreignId('company_id')->nullable()->constrained('users','id')->onDelete('set null'); $table->string('lang')->default('ar')->nullable(); $table->enum('offers_notify',['true','false'])->nullable()->default('true'); $table->enum('new_orders_notify',['true','false'])->nullable()->default('true'); $table->rememberToken(); $table->timestamps(); $table->softDeletes(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('users'); } }
Back to File Manager