CreateContactsTables   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
B up() 0 41 1
A down() 0 7 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use \jlourenco\base\Database\Blueprint;
5
6
class CreateContactsTables 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('ContactType', function (Blueprint $table) {
18
            $table->increments('id');
19
            $table->string('name', 100);
20
            $table->text('html')->nullable();
21
            $table->string('description', 250);
22
23
            $table->timestamps();
24
            $table->softDeletes();
25
            $table->creation();
26
        });
27
28
        Schema::create('Contact', function (Blueprint $table) {
29
            $table->increments('id');
30
            $table->string('contact_reference', 50);
31
            $table->integer('contacttype')->unsigned();
32
            $table->string('contact', 250);
33
            $table->text('permissions');
34
35
            $table->timestamps();
36
            $table->softDeletes();
37
            $table->creation();
38
39
            $table->foreign('contacttype')->references('id')->on('ContactType');
40
        });
41
42
        Schema::create('Contact_Entity', function (Blueprint $table) {
43
            $table->increments('id');
44
            $table->integer('contact')->unsigned();
45
            $table->morphs("entity");
46
47
            $table->timestamps();
48
            $table->softDeletes();
49
            $table->creation();
50
51
            $table->foreign('contact')->references('id')->on('Contact');
52
        });
53
54
    }
55
56
    /**
57
     * Reverse the migrations.
58
     *
59
     * @return void
60
     */
61
    public function down()
62
    {
63
64
        Schema::drop('Contact');
65
        Schema::drop('ContactType');
66
67
    }
68
69
}
70