Total Complexity | 3 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class CreateTwoStepAuthTable extends Migration |
||
|
|||
9 | { |
||
10 | /** |
||
11 | * Run the migrations. |
||
12 | * |
||
13 | * @return void |
||
14 | */ |
||
15 | public function up() |
||
16 | { |
||
17 | $twoStepAuth = new TwoStepAuth(); |
||
18 | $connection = $twoStepAuth->getConnectionName(); |
||
19 | $table = $twoStepAuth->getTableName(); |
||
20 | $tableCheck = Schema::connection($connection)->hasTable($table); |
||
21 | |||
22 | if (! $tableCheck) { |
||
23 | Schema::connection($connection)->create($table, function (Blueprint $table) { |
||
24 | $table->increments('id'); |
||
25 | $table->unsignedBigInteger('userId')->unsigned()->index(); |
||
26 | $table->foreign('userId')->references('id')->on('users')->onDelete('cascade'); |
||
27 | $table->string('authCode')->nullable(); |
||
28 | $table->integer('authCount'); |
||
29 | $table->boolean('authStatus')->default(false); |
||
30 | $table->dateTime('authDate')->nullable(); |
||
31 | $table->dateTime('requestDate')->nullable(); |
||
32 | $table->timestamps(); |
||
33 | }); |
||
34 | } |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Reverse the migrations. |
||
39 | * |
||
40 | * @return void |
||
41 | */ |
||
42 | public function down() |
||
49 | } |
||
50 | } |
||
51 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.