CreateRatingTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 24
c 1
b 0
f 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 10 1
A down() 0 3 1
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateRatingTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     */
12
    public function up()
13
    {
14
        Schema::create(config('rating.table_name', 'ratings'), function (Blueprint $table) {
15
            $table->increments('id');
16
            $table->string('rater_type')->nullable();
17
            $table->integer('rater_id')->nullable();
18
            $table->string('rateable_type');
19
            $table->string('rateable_id');
20
            $table->float('rating', 9, 2);
21
            $table->timestamps();
22
        });
23
    }
24
25
    /**
26
     * Reverse the migrations.
27
     */
28
    public function down()
29
    {
30
        Schema::dropIfExists(config('rating.table_name', 'ratings'));
31
    }
32
}
33