Completed
Push — master ( eebd52...3cd9a5 )
by ARCANEDEV
08:34
created

CreateBlogCategoriesTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 13
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
use Arcanesoft\Blog\Bases\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
/**
7
 * Class     CreateBlogCategoriesTable
8
 *
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class CreateBlogCategoriesTable extends Migration
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Constructor
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * CreateBlogCategoriesTable constructor.
19
     */
20
    public function __construct()
21
    {
22
        parent::__construct();
23
24
        $this->setTable('categories');
25
    }
26
27
    /* ------------------------------------------------------------------------------------------------
28
     |  Main Functions
29
     | ------------------------------------------------------------------------------------------------
30
     */
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function up()
35
    {
36
        $this->createSchema(function(Blueprint $table) {
37
            $table->increments('id');
38
            $table->string('name', 50);
39
            $table->string('slug', 50);
40
            $table->timestamps();
41
            $table->softDeletes();
42
43
            $table->unique('name');
44
            $table->unique('slug');
45
        });
46
    }
47
}
48