| Total Complexity | 4 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class CreateTwillUsersTables extends Migration |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Run the migrations. |
||
| 11 | * |
||
| 12 | * @return void |
||
| 13 | */ |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | $twillUsersTable = config('twill.users_table', 'twill_users'); |
||
| 17 | |||
| 18 | if (!Schema::hasTable($twillUsersTable)) { |
||
| 19 | Schema::create($twillUsersTable, function (Blueprint $table) { |
||
| 20 | createDefaultTableFields($table); |
||
| 21 | $table->string('name'); |
||
| 22 | $table->string('email')->unique(); |
||
| 23 | $table->string('password', 60)->nullable()->default(null); |
||
| 24 | $table->string('role', 100); |
||
| 25 | $table->string('title', 255)->nullable(); |
||
| 26 | $table->text('description')->nullable(); |
||
| 27 | $table->rememberToken(); |
||
| 28 | }); |
||
| 29 | } |
||
| 30 | |||
| 31 | $twillPasswordResetsTable = config('twill.password_resets_table', 'twill_password_resets'); |
||
| 32 | |||
| 33 | if (!Schema::hasTable($twillPasswordResetsTable)) { |
||
| 34 | Schema::create($twillPasswordResetsTable, function (Blueprint $table) { |
||
| 35 | $table->string('email')->index(); |
||
| 36 | $table->string('token')->index(); |
||
| 37 | $table->timestamp('created_at')->nullable(); |
||
| 38 | }); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Reverse the migrations. |
||
| 44 | * |
||
| 45 | * @return void |
||
| 46 | */ |
||
| 47 | public function down() |
||
| 48 | { |
||
| 49 | Schema::dropIfExists(config('twill.password_resets_table', 'twill_password_resets')); |
||
| 50 | Schema::dropIfExists(config('twill.users_table', 'twill_users')); |
||
| 51 | } |
||
| 53 |