CreateTransactionsTable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
c 0
b 0
f 0
dl 0
loc 47
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 16 1
A down() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
use Nxmad\Larapay\Models\Transaction;
4
use Illuminate\Database\Schema\Builder;
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Database\Migrations\Migration;
7
8
class CreateTransactionsTable extends Migration
9
{
10
    /**
11
     * @var Builder
12
     */
13
    public $builder;
14
15
    /**
16
     * CreateTransactionsTable constructor.
17
     */
18
    public function __construct()
19
    {
20
        $this->builder = app(Builder::class);
0 ignored issues
show
Bug introduced by
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $this->builder = /** @scrutinizer ignore-call */ app(Builder::class);
Loading history...
21
    }
22
23
    /**
24
     * Run the migrations.
25
     *
26
     * @return void
27
     */
28
    public function up()
29
    {
30
        $this->builder->create('transactions', function (Blueprint $table) {
31
            $table->bigIncrements('id');
32
33
            $table->decimal('amount');
34
35
            $table->json('meta')->nullable();
36
37
            $table->enum('state', Transaction::STATES);
38
39
            $table->unsignedInteger('subject_id');
40
41
            $table->string('subject_type');
42
43
            $table->timestamps();
44
        });
45
    }
46
47
    /**
48
     * Reverse the migrations.
49
     *
50
     * @return void
51
     */
52
    public function down()
53
    {
54
        $this->builder->dropIfExists('transactions');
55
    }
56
}
57