CreatePcmmPermissionsTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 17
rs 9.8666
c 1
b 0
f 0
1
<?php
2
3
use Illuminate\Support\Facades\Artisan;
4
use Illuminate\Support\Facades\Schema;
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Database\Migrations\Migration;
7
8
class CreatePcmmPermissionsTable extends Migration
9
{
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        Schema::create('pcmm_permissions', function (Blueprint $table) {
18
            $table->increments('id');
19
            $table->integer('menu_id')->unsigned()->index();
20
            $table->string('namespace', 255)->index();
21
            $table->string('controller', 255)->index();
22
            $table->enum('method', ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])->index();
23
            $table->string('action', 255)->index();
24
            $table->boolean('allowed')->default(true);
25
            $table->timestamps();
26
27
        });
28
29
        Artisan::call('db:seed', [
30
            '--class' => PcmmPermissionsTableSeeder::class,
31
            '--force'   => true
32
        ]);
33
    }
34
35
    /**
36
     * Reverse the migrations.
37
     *
38
     * @return void
39
     */
40
    public function down()
41
    {
42
        Schema::dropIfExists('pcmm_permissions');
43
    }
44
}
45