[2fc88ec] | 1 | <?php
|
---|
| 2 |
|
---|
[7304c7f] | 3 | use Illuminate\Support\Str;
|
---|
[2fc88ec] | 4 | use Illuminate\Support\Facades\Schema;
|
---|
[7304c7f] | 5 | use Illuminate\Database\Schema\Blueprint;
|
---|
| 6 | use Illuminate\Database\Migrations\Migration;
|
---|
[2fc88ec] | 7 |
|
---|
| 8 | class CreateUsersTable extends Migration
|
---|
| 9 | {
|
---|
| 10 | /**
|
---|
| 11 | * Run the migrations.
|
---|
| 12 | *
|
---|
| 13 | * @return void
|
---|
| 14 | */
|
---|
| 15 | public function up()
|
---|
| 16 | {
|
---|
| 17 | Schema::create('users', function (Blueprint $table) {
|
---|
[5e56e8a] | 18 | $table->increments('id')->startingValue(1);
|
---|
[2fc88ec] | 19 | $table->string('name');
|
---|
[7304c7f] | 20 | $table->string('surname');
|
---|
| 21 | $table->string('username')->unique();
|
---|
| 22 | $table->string('email')->unique();
|
---|
[d795fa6] | 23 | $table->string('phone_number')->unique();
|
---|
[24a616f] | 24 | $table->string('avatar')->nullable();
|
---|
[7304c7f] | 25 | $table->integer('role_id')->unsigned();
|
---|
| 26 | $table->foreign("role_id")->references("id")->on("roles");
|
---|
| 27 | $table->boolean('is_active')->default(false);
|
---|
| 28 | $table->boolean('is_online')->default(false);
|
---|
| 29 | $table->boolean('is_confirmed')->default(false);
|
---|
| 30 | $table->boolean('is_forgot_password')->default(false);
|
---|
[c6b84df] | 31 | $table->integer("created_by")->unsigned();
|
---|
[1c25bcf] | 32 | $table->string('security_code')->nullable();
|
---|
[7304c7f] | 33 | $table->string('verify_token')->nullable();
|
---|
[c6b84df] | 34 | $table->string('password');
|
---|
[2fc88ec] | 35 | $table->rememberToken();
|
---|
| 36 | $table->timestamps();
|
---|
[d795fa6] | 37 |
|
---|
| 38 | $table->foreign("created_by")->references("id")->on("users")->onDelete("cascade")->onUpdate("cascade");
|
---|
[2fc88ec] | 39 | });
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | /**
|
---|
| 43 | * Reverse the migrations.
|
---|
| 44 | *
|
---|
| 45 | * @return void
|
---|
| 46 | */
|
---|
| 47 | public function down()
|
---|
| 48 | {
|
---|
| 49 | Schema::dropIfExists('users');
|
---|
| 50 | }
|
---|
| 51 | }
|
---|