Completed
Push — master ( 936afc...005576 )
by Emmanuel
01:16
created

CreateTicketReferencesTable::up()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 14

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.7998
c 0
b 0
f 0
cc 2
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7 View Code Duplication
class CreateTicketReferencesTable extends Migration
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create(config('laravel-tickets.database.ticket-references-table'), function (Blueprint $table) {
17
            $table->id();
18
            $table->unsignedBigInteger('ticket_id');
19
            $table->morphs('referenceable');
20
            $table->timestamps();
21
22
            if (! config('laravel-tickets.models.uuid')) {
23
                $table->foreign('ticket_id')
24
                    ->on(config('laravel-tickets.database.tickets-table'))->references('id');
25
            }
26
        });
27
    }
28
29
    /**
30
     * Reverse the migrations.
31
     *
32
     * @return void
33
     */
34
    public function down()
35
    {
36
        Schema::dropIfExists(config('laravel-tickets.database.ticket-references-table'));
37
    }
38
}
39