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

down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 2
b 0
f 0
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