Completed
Push — master ( 7e131c...271c01 )
by Reza
27s queued 20s
created

CreateCrudsTableEasypanel   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 13 1
A down() 0 3 1
A getConnection() 0 3 2
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateCrudsTableEasypanel extends Migration
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function getConnection()
13
    {
14
        return config('easy_panel_config.database.connection') ?: config('database.default');
15
    }
16
17
    /**
18
     * Run the migrations.
19
     *
20
     * @return void
21
     */
22
    public function up()
23
    {
24
        Schema::create(config('easy_panel_config.database.crud_table'), function (Blueprint $table) {
25
            $table->id();
26
            $table->string('name')->unique();
27
            $table->string('model')->unique();
28
            $table->string('route')->unique();
29
            $table->string('icon')->default('fas fa-bars');
30
            $table->boolean('active')->default(true);
31
            $table->boolean('built')->default(false);
32
            $table->boolean('with_acl')->default(false);
33
            $table->boolean('with_policy')->default(false);
34
            $table->timestamps();
35
        });
36
    }
37
38
    /**
39
     * Reverse the migrations.
40
     *
41
     * @return void
42
     */
43
    public function down()
44
    {
45
        Schema::dropIfExists(config('easy_panel_config.database.crud_table'));
46
    }
47
}
48