CreateGuidedImagesTable   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 48
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A up() 0 19 2
A down() 0 6 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
use ReliqArts\GuidedImage\Contract\ConfigProvider;
7
8
class CreateGuidedImagesTable extends Migration
9
{
10
    /**
11
     * @var ConfigProvider
12
     */
13
    private $configProvider;
14
15
    /**
16
     * CreateGuidedImagesTable constructor.
17
     */
18
    public function __construct()
19
    {
20
        $this->configProvider = resolve(ConfigProvider::class);
21
    }
22
23
    /**
24
     * Run the migrations.
25
     */
26
    public function up()
27
    {
28
        $tableName = $this->configProvider->getImagesTableName();
29
30
        if (!Schema::hasTable($tableName)) {
31
            Schema::create($tableName, function (Blueprint $table) {
32
                $table->increments('id');
33
                $table->string('name', 50);
34
                $table->string('mime_type', 20);
35
                $table->string('extension', 10);
36
                $table->integer('size');
37
                $table->integer('height');
38
                $table->integer('width');
39
                $table->string('location');
40
                $table->string('full_path');
41
                $table->timestamps();
42
            });
43
        }
44
    }
45
46
    /**
47
     * Reverse the migrations.
48
     */
49
    public function down()
50
    {
51
        $tableName = $this->configProvider->getImagesTableName();
52
53
        Schema::dropIfExists($tableName);
54
    }
55
}
56