2021_05_18_083357_create_users_table.php
1 <?php 2 3 use Illuminate\Database\Migrations\Migration; 4 use Illuminate\Database\Schema\Blueprint; 5 use Illuminate\Support\Facades\Schema; 6 7 class CreateUsersTable extends Migration 8 { 9 /** 10 * Run the migrations. 11 * 12 * @return void 13 */ 14 public function up() 15 { 16 Schema::create('users', function (Blueprint $table) { 17 $table->id(); 18 $table->timestamps(); 19 $table->softDeletes(); 20 $table->foreignId('user_type_id')->nullable()->constrained('users_types')->cascadeOnUpdate()->nullOnDelete(); 21 $table->string('internal_identification_number')->nullable(); 22 $table->string('personal_identification_number')->nullable(); 23 $table->string('alias')->nullable()->unique(); 24 $table->string('name')->nullable(); 25 $table->string('lastname')->nullable(); 26 $table->string('email')->nullable(); 27 $table->string('phone')->nullable(); 28 $table->string('address')->nullable(); 29 30 $table->string('username')->unique(); 31 $table->string('password'); 32 $table->boolean('enforce_2fa')->default(false); 33 $table->boolean('can_access_inbox')->default(false); 34 $table->boolean('can_login')->default(true); 35 $table->boolean('is_active')->default(true); 36 }); 37 } 38 39 /** 40 * Reverse the migrations. 41 * 42 * @return void 43 */ 44 public function down() 45 { 46 Schema::dropIfExists('users'); 47 } 48 }