CreateCategoriesTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A up() 0 11 1
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