Passed
Pull Request — master (#76)
by
unknown
20:16
created

CreatePanelAdminsTableEasypanel   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getConnection() 0 3 2
A up() 0 9 1
A down() 0 3 1
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