CreateCategoriesTable::up()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 18
nc 1
nop 0
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateCategoriesTable 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...
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        Schema::create('categories', function (Blueprint $table) {
16
            $table->increments('id');
17
            // nested sets fields
18
            $table->unsignedInteger('parent_id')->nullable()->index();
19
            $table->unsignedInteger('lft')->nullable()->index();
20
            $table->unsignedInteger('rgt')->nullable()->index();
21
            $table->unsignedInteger('depth')->nullable();
22
23
            $table->string('title');
24
            $table->string('alias');
25
            $table->string('note')->nullable();
26
            $table->boolean('published')->default(false)->index();
27
            $table->boolean('authenticated')->default(false)->index();
28
            $table->integer('hits')->default(0);
29
            $table->mediumText('description')->nullable();
30
            $table->text('parameters')->nullable();
31
32
            $table->unsignedInteger('created_by')->nullable()->index();
33
            $table->unsignedInteger('updated_by')->nullable()->index();
34
            $table->timestamps();
35
        });
36
    }
37
38
    /**
39
     * Reverse the migrations.
40
     *
41
     * @return void
42
     */
43
    public function down()
44
    {
45
        Schema::drop('categories');
46
    }
47
}
48