CreateLogistiqTrackingUpdatesTable::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 8
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Migrations\Migration;
6
use Illuminate\Database\Schema\Blueprint;
7
use Illuminate\Support\Facades\Schema;
8
use ReliqArts\Logistiq\Tracking\Models\TrackingUpdate;
9
use ReliqArts\Logistiq\Utility\Contracts\ConfigProvider;
10
11
class CreateLogistiqTrackingUpdatesTable extends Migration
12
{
13
    /**
14
     * @var string
15
     */
16
    private $table;
17
18
    /**
19
     * CreateLogistiqTrackingUpdatesTable constructor.
20
     */
21
    public function __construct()
22
    {
23
        /**
24
         * @var ConfigProvider
25
         */
26
        $configProvider = resolve(ConfigProvider::class);
27
28
        $this->table = $configProvider->getTableNameByKey(TrackingUpdate::TABLE_KEY);
29
    }
30
31
    /**
32
     * Run the migrations.
33
     */
34
    public function up()
35
    {
36
        Schema::create($this->table, function (Blueprint $table) {
37
            $table->bigIncrements('id');
38
            $table->string(TrackingUpdate::COLUMN_TRACKABLE_IDENTIFIER);
39
            $table->string(TrackingUpdate::COLUMN_TRACKABLE_TYPE);
40
            $table->string(TrackingUpdate::COLUMN_STATUS_IDENTIFIER);
41
            $table->timestamps();
42
        });
43
    }
44
45
    /**
46
     * Reverse the migrations.
47
     */
48
    public function down()
49
    {
50
        Schema::dropIfExists($this->table);
51
    }
52
}
53