CreateCategorizableTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
use Arcanedev\Taxonomies\Bases\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
/**
7
 * Class     CreateCategorizableTable
8
 *
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class CreateCategorizableTable extends Migration
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Constructor
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    public function __construct()
18
    {
19
        parent::__construct();
20
21
        $this->setTable(config('taxonomies.categories.morph.table', 'categories_relations'));
22
    }
23
24
    /* ------------------------------------------------------------------------------------------------
25
     |  Main Functions
26
     | ------------------------------------------------------------------------------------------------
27
     */
28
    /**
29
     * Migrate to database.
30
     */
31
    public function up()
32
    {
33
        $this->createSchema(function (Blueprint $table) {
34
            $table->integer('category_id');
35
            $table->morphs(config('taxonomies.categories.morph.name', 'categorizable'));
36
            $table->timestamps();
37
        });
38
    }
39
}
40