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

CreatePanelAdminsTableEasypanel::getConnection()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
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 CreatePanelAdminsTableEasypanel 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
     * Run the migrations.
18
     *
19
     * @return void
20
     */
21
    public function up()
22
    {
23
        Schema::create(config('easy_panel_config.database.panel_admin_table'), function (Blueprint $table) {
24
            $table->id();
25
            $table->foreignId('user_id')->constrained();
26
            $table->boolean('is_superuser');
27
            $table->timestamps();
28
29
            $table->unique(['user_id']);
30
        });
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        Schema::dropIfExists(config('easy_panel_config.database.panel_admin_table'));
41
    }
42
}
43