Passed
Branch master (98ac03)
by Christian
04:34
created

CreateSpatieRolesTable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 33
ccs 14
cts 14
cp 1
rs 10
wmc 3
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
    public function up()
15
    {
16
        $tableNames = config('permission.table_names');
17
18
        Schema::create($tableNames['roles'], function (Blueprint $table) {
19
            $table->bigIncrements('id');
20
            $table->string('name');
21
            $table->string('guard_name');
22
            $table->timestamps();
23
        });
24
25
        app('cache')
26
            ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
27
            ->forget(config('permission.cache.key'));
28
    }
29
30
    /**
31
     * Reverse the migrations.
32
     *
33
     * @return void
34
     */
35
    public function down()
36
    {
37
        $tableNames = config('permission.table_names');
38
39
        Schema::drop($tableNames['roles']);
40
    }
41
}
42