CreateImageTransformationsTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
cc 1
eloc 18
nc 1
nop 0
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
/**
8
 * Create Image Transformations Table
9
 *
10
 * @category Migrations
11
 * @package  HustleWorks\ChuteLaravel
12
 * @author   Don Herre <[email protected]>
13
 * @license  Proprietary and confidential
14
 * @link     http://hustleworks.com
15
 */
16
class CreateImageTransformationsTable 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...
17
{
18
    /**
19
     * Run the migrations.
20
     *
21
     * @return void
22
     */
23
    public function up()
24
    {
25
        Schema::create('image_transformations', function (Blueprint $table) {
26
            $table->increments('id');
27
            $table->integer('image_id')->unsigned();
28
            $table->string('name');
29
            $table->string('filename');
30
            $table->string('disk');
31
            $table->string('width')->nullable();
32
            $table->string('height')->nullable();
33
            $table->string('quality')->nullable();
34
            $table->integer('size')->nullable();
35
            $table->timestamps();
36
            $table->softDeletes();
37
38
            $table->foreign('image_id')
39
                ->references('id')
40
                ->on('images')
41
                ->onDelete('cascade')
42
                ->onUpdate('cascade');
43
        });
44
    }
45
46
    /**
47
     * Reverse the migrations.
48
     *
49
     * @return void
50
     */
51
    public function down()
52
    {
53
        Schema::drop('image_transformations');
54
    }
55
}