CreateCategoriesTable::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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