dropTimestamps()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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