ModifyRolesAndPermissionsTablesRemoveTimestamps   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 25
rs 10
c 2
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createTimestamps() 0 4 1
A up() 0 4 1
A dropTimestamps() 0 4 1
A down() 0 4 1
1
<?php
2
3
use Helldar\Roles\Support\Database\BaseMigration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
class ModifyRolesAndPermissionsTablesRemoveTimestamps extends BaseMigration
7
{
8
    public function up()
9
    {
10
        $this->dropTimestamps($this->roles);
11
        $this->dropTimestamps($this->permissions);
12
    }
13
14
    public function down()
15
    {
16
        $this->createTimestamps($this->roles);
17
        $this->createTimestamps($this->permissions);
18
    }
19
20
    protected function dropTimestamps(string $table)
21
    {
22
        $this->table($table, function (Blueprint $table) {
23
            $table->dropTimestamps();
24
        });
25
    }
26
27
    protected function createTimestamps(string $table)
28
    {
29
        $this->table($table, function (Blueprint $table) {
30
            $table->timestamps();
31
        });
32
    }
33
}
34