CreateRolesTable::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
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
use Thinkstudeo\Rakshak\Role;
7
8
class CreateRolesTable extends Migration
9
{
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        Schema::create('roles', function (Blueprint $table) {
18
            $table->uuid('id');
19
            $table->string('name')->unique();
20
            $table->string('label');
21
            $table->string('slug')->unique();
22
            $table->string('description');
23
            $table->boolean('active')->default(true);
24
            $table->timestamps();
25
26
            $table->primary('id');
27
        });
28
29
        Role::create(['name' => config('rakshak.roles.super_user'), 'label' => 'Super User', 'description' => 'All abilities for the application interaction.']);
30
        Role::create(['name' => config('rakshak.roles.authorizer'), 'label' => 'Roles & Abilities Manager', 'description' => 'Can perform crud ops for Role and Ability']);
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        Schema::dropIfExists('roles');
41
    }
42
}
43