CreateMigrationsTable::up()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 26
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
class CreateMigrationsTable 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...
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('inventories', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->integer('public_id');
19
            $table->string('name', 80);
20
            $table->string('description', 120);
21
            $table->integer('material_type_id')->unsigned();
22
            $table->integer('brand_id')->unsigned();
23
            $table->integer('model_id')->unsigned();
24
            $table->integer('location_id')->unsigned();
25
            $table->integer('quantity');
26
            $table->double('price');
27
            $table->integer('moneysourceId')->unsigned();
28
            $table->integer('provider_id')->unsigned();
29
            $table->date('date_entrance');
30
            $table->date('last_update');
31
            $table->string('picture', 60);
32
            $table->timestamps();
33
            $table->softDeletes();
34
        });
35
36
        Schema::table('inventories', function ($table) {
37
            $table->foreign('material_type_id')->references('id')->on('material_type')->onDelete('cascade');
38
            $table->foreign('brand_id')->references('id')->on('brand')->onDelete('cascade');
39
            $table->foreign('model_id')->references('id')->on('brand_model')->onDelete('cascade');
40
            $table->foreign('location_id')->references('id')->on('location')->onDelete('cascade');
41
            $table->foreign('moneySourceId')->references('id')->on('moneySource')->onDelete('cascade');
42
            $table->foreign('provider_id')->references('id')->on('providers')->onDelete('cascade');
43
        });
44
    }
45
46
    /**
47
     * Reverse the migrations.
48
     *
49
     * @return void
50
     */
51
    public function down()
52
    {
53
        Schema::dropIfExists('inventories');
54
    }
55
}
56