Edit File: 2020_08_21_000000_create_users_table.php
<?php use App\Enums\GenderEnum; use App\Models\City; use App\Models\Country; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateUsersTable extends Migration { public function up() { Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('image', 50)->default('default.png'); $table->string('cover', 50)->default('default.png'); $table->string('first_name', 50)->nullable(); $table->string('last_name', 50)->nullable(); $table->string('phone', 15)->nullable(); $table->string('country_code', 5)->default('966'); $table->string('email', 50)->nullable(); $table->enum('gender', GenderEnum::values())->nullable(); $table->date('birth_date')->nullable(); $table->foreignIdFor(Country::class)->nullable()->index()->constrained()->nullOnDelete(); $table->foreignIdFor(City::class)->nullable()->index()->constrained()->nullOnDelete(); $table->boolean('is_active')->default(false); $table->boolean('is_blocked')->default(false); $table->boolean('is_notify')->default(true); $table->string('bio', 255)->nullable(); $table->string('lat')->nullable(); $table->string('lng')->nullable(); $table->string('map_desc', 255)->nullable(); $table->softDeletes(); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); }); } public function down() { Schema::dropIfExists('users'); } }
Back to File Manager