CreateRulesTables   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 53
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B up() 0 30 1
A down() 0 7 1
1
<?php
2
3
use jlourenco\base\Database\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateRulesTables 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('Rule', function (Blueprint $table) {
18
            $table->increments('id');
19
            $table->string('title', 100);
20
            $table->text('rule');
21
            $table->binary('status');
22
23
            $table->timestamps();
24
            $table->softDeletes();
25
            $table->creation();
26
        });
27
28
        Schema::create('RuleTree', function (Blueprint $table) {
29
            $table->increments('id');
30
            $table->string('title', 100)->nullable();
31
            $table->integer('rule')->unsigned()->nullable();
32
            $table->integer('parent')->unsigned()->nullable();
33
            $table->string('list', 100);
34
35
            $table->timestamps();
36
            $table->softDeletes();
37
            $table->creation();
38
39
            $table->foreign('rule')->references('id')->on('Rule');
40
            $table->foreign('parent')->references('id')->on('RuleTree');
41
        });
42
43
    }
44
45
    /**
46
     * Reverse the migrations.
47
     *
48
     * @return void
49
     */
50
    public function down()
51
    {
52
53
        Schema::drop('RuleTree');
54
        Schema::drop('Rule');
55
56
    }
57
58
}
59