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

CreateSpatieRolesTable::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
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