Passed
Push — main ( 52a9ba...b89683 )
by PRATIK
04:37 queued 14s
created

CreateCategoriesTable::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 2
b 0
f 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 CreateCategoriesTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('categories', function (Blueprint $table) {
17
            $table->id();
18
            $table->string('model');
19
            $table->string('code')->unique();
20
            $table->string('name');
21
            $table->string('slug')->unique();
22
            $table->unsignedBigInteger('category_id')->nullable();
23
            $table->boolean('active')->default(1);
24
            $table->string('color')->default(random_color());
0 ignored issues
show
Bug introduced by
The function random_color 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

24
            $table->string('color')->default(/** @scrutinizer ignore-call */ random_color());
Loading history...
25
            $table->string('icon')->nullable();
26
            $table->string('image')->nullable();
27
            $table->text('description')->nullable();
28
            $table->bigInteger('position')->default(0);
29
30
31
            $table->string('meta_name')->nullable();
32
            $table->string('meta_description')->nullable();
33
            $table->json('meta_keywords')->nullable();
34
            $table->timestamps();
35
        });
36
    }
37
38
    /**
39
     * Reverse the migrations.
40
     *
41
     * @return void
42
     */
43
    public function down()
44
    {
45
        Schema::dropIfExists('categories');
46
    }
47
}
48