Completed
Push — master ( b985db...bee0c3 )
by Christian
05:14
created

CreateSpatieRolesTable::up()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 14
ccs 10
cts 10
cp 1
crap 2
rs 9.9666
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateSpatieRolesTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14 51
    public function up()
15
    {
16 51
        $tableNames = config('permission.table_names');
17
18
        Schema::create($tableNames['roles'], function (Blueprint $table) {
19 51
            $table->bigIncrements('id');
20 51
            $table->string('name');
21 51
            $table->string('guard_name');
22 51
            $table->timestamps();
23 51
        });
24
25 51
        app('cache')
26 51
            ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
27 51
            ->forget(config('permission.cache.key'));
28 51
    }
29
30
    /**
31
     * Reverse the migrations.
32
     *
33
     * @return void
34
     */
35 51
    public function down()
36
    {
37 51
        $tableNames = config('permission.table_names');
38
39 51
        Schema::drop($tableNames['roles']);
40 51
    }
41
}
42