CreateFollowablesTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 14 1
A down() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of questocat/laravel-rally package.
5
 *
6
 * (c) questocat <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
use Illuminate\Database\Migrations\Migration;
13
use Illuminate\Database\Schema\Blueprint;
14
15
class CreateFollowablesTable 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...
16
{
17
    /**
18
     * Run the migrations.
19
     */
20
    public function up()
21
    {
22
        Schema::create(config('rally.followers_table', 'followables'), function (Blueprint $table) {
23
            $table->increments('id');
24
            $table->integer('follower_id')->unsigned()->index();
25
            $table->morphs('followable');
26
            $table->timestamps();
27
            $table->foreign('follower_id')
28
                  ->references('id')
29
                  ->on(config('rally.follower_table', 'users'))
30
                  ->onUpdate('cascade')
31
                  ->onDelete('cascade');
32
        });
33
    }
34
35
    /**
36
     * Reverse the migrations.
37
     */
38
    public function down()
39
    {
40
        Schema::drop(config('rally.followers_table', 'followables'));
41
    }
42
}
43