CreateBlogPostTagPivot::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
use Arcanesoft\Blog\Bases\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
/**
7
 * Class     CreateBlogTagsTable
8
 *
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class CreateBlogPostTagPivot extends Migration
12
{
13
    /* -----------------------------------------------------------------
14
     |  Constructor
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * CreateBlogTagsTable constructor.
20
     */
21
    public function __construct()
22
    {
23
        parent::__construct();
24
25
        $this->setTable('post_tag');
26
    }
27
28
    /* -----------------------------------------------------------------
29
     |  Main Methods
30
     | -----------------------------------------------------------------
31
     */
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function up()
37
    {
38
        $this->createSchema(function(Blueprint $table) {
39
            $table->unsignedInteger('post_id');
40
            $table->unsignedInteger('tag_id');
41
42
            $table->primary(['post_id', 'tag_id']);
43
        });
44
    }
45
}
46