CreateLaravelBlockerTypesTable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 7 1
A up() 0 14 2
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Migrations\Migration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
use Illuminate\Database\Schema\Blueprint;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Schema\Blueprint was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use Illuminate\Support\Facades\Schema;
6
use jeremykenedy\LaravelBlocker\App\Models\BlockedType;
7
8
class CreateLaravelBlockerTypesTable extends Migration
9
{
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        $blocked = new BlockedType();
18
        $connection = $blocked->getConnectionName();
19
        $table = $blocked->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->string('slug')->unique();
26
                $table->string('name');
27
                $table->timestamps();
28
                $table->softDeletes();
29
            });
30
        }
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        $blockedType = new BlockedType();
41
        $connection = $blockedType->getConnectionName();
42
        $table = $blockedType->getTableName();
43
44
        Schema::connection($connection)->dropIfExists($table);
45
    }
46
}
47