Role   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 27
dl 0
loc 69
rs 10
c 2
b 1
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
1
<?php
2
3
namespace jeremykenedy\LaravelRoles\Models;
4
5
use Illuminate\Database\Eloquent\SoftDeletes;
6
use jeremykenedy\LaravelRoles\Contracts\RoleHasRelations as RoleHasRelationsContract;
7
use jeremykenedy\LaravelRoles\Database\Database;
8
use jeremykenedy\LaravelRoles\Traits\RoleHasRelations;
9
use jeremykenedy\LaravelRoles\Traits\Slugable;
10
11
class Role extends Database implements RoleHasRelationsContract
12
{
13
    use RoleHasRelations;
14
    use Slugable;
15
    use SoftDeletes;
16
    /**
17
     * The attributes that are not mass assignable.
18
     *
19
     * @var array
20
     */
21
    protected $guarded = [
22
        'id',
23
    ];
24
25
    /**
26
     * The attributes that should be mutated to dates.
27
     *
28
     * @var array
29
     */
30
    protected $dates = [
31
        'created_at',
32
        'updated_at',
33
        'deleted_at',
34
    ];
35
36
    /**
37
     * The attributes that are mass assignable.
38
     *
39
     * @var array
40
     */
41
    protected $fillable = [
42
        'name',
43
        'slug',
44
        'description',
45
        'level',
46
    ];
47
48
    /**
49
     * Typecast for protection.
50
     *
51
     * @var array
52
     */
53
    protected $casts = [
54
        'id'            => 'integer',
55
        'name'          => 'string',
56
        'slug'          => 'string',
57
        'description'   => 'string',
58
        'level'         => 'integer',
59
        'created_at'    => 'datetime',
60
        'updated_at'    => 'datetime',
61
        'deleted_at'    => 'datetime',
62
    ];
63
64
    /**
65
     * Indicates if the model should be timestamped.
66
     *
67
     * @var bool
68
     */
69
    public $timestamps = true;
70
71
    /**
72
     * Create a new model instance.
73
     *
74
     * @param array $attributes
75
     */
76
    public function __construct(array $attributes = [])
77
    {
78
        parent::__construct($attributes);
79
        $this->table = config('roles.rolesTable');
80
    }
81
}
82