Passed
Push — master ( 3d397a...3f0190 )
by Andrey
12:15
created

ModifyRolesAndPermissionsTablesRemoveTimestamps   A

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 Illuminate\Database\Schema\Blueprint;
4
5
class ModifyRolesAndPermissionsTablesRemoveTimestamps extends BaseMigration
6
{
7
    public function up()
8
    {
9
        $this->dropTimestamps($this->roles);
10
        $this->dropTimestamps($this->permissions);
11
    }
12
13
    public function down()
14
    {
15
        $this->createTimestamps($this->roles);
16
        $this->createTimestamps($this->permissions);
17
    }
18
19
    protected function dropTimestamps(string $table)
20
    {
21
        $this->table($table, function (Blueprint $table) {
22
            $table->dropTimestamps();
23
        });
24
    }
25
26
    protected function createTimestamps(string $table)
27
    {
28
        $this->table($table, function (Blueprint $table) {
29
            $table->timestamps();
30
        });
31
    }
32
}
33