CreateCommentsTables::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 1
Metric Value
c 4
b 0
f 1
dl 0
loc 17
rs 9.4285
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use \jlourenco\support\Database\Blueprint;
5
6
class CreateCommentsTables extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
17
        Schema::create('Comment', function (Blueprint $table) {
18
            $table->increments('id');
19
            $table->integer('parent')->unsigned()->nullable();
20
            $table->text('comment');
21
22
            $table->morphs("entity");
23
            $table->timestamps();
24
            $table->softDeletes();
25
            $table->creation();
26
27
            $table->foreign('parent')->references('id')->on('Comment');
28
        });
29
30
    }
31
32
    /**
33
     * Reverse the migrations.
34
     *
35
     * @return void
36
     */
37
    public function down()
38
    {
39
40
        Schema::drop('Comment');
41
42
    }
43
44
}
45