Grantable::getFillable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 6
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Created on 11/02/18 by enea dhack.
7
 */
8
9
namespace Enea\Authorization\Models;
10
11
use Carbon\Carbon;
12
use Illuminate\Database\Eloquent\Model;
13
14
abstract class Grantable extends Model
15
{
16 83
    public function __construct(array $attributes = [])
17
    {
18 83
        $this->setTable($this->getConfigTableName());
19 83
        parent::__construct($attributes);
20 83
    }
21
22
    abstract protected function getConfigTableName(): string;
23
24 83
    public function getFillable()
25
    {
26
        return [
27 83
            'secret_name',
28
            'display_name',
29
            'description'
30
        ];
31
    }
32
33 9
    public function __toString()
34
    {
35 9
        return $this->getAttribute('secret_name');
36
    }
37
38 2
    protected function serializeDate(\DateTimeInterface $date): string
39
    {
40 2
        return Carbon::instance($date)->toDateTimeString();
41
    }
42
}
43