Passed
Push — master ( 0f5478...69af09 )
by Ion
04:44
created

Permission   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 19
c 1
b 0
f 1
dl 0
loc 50
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A rolePermissions() 0 3 1
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Relations\HasMany;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
8
/**
9
 * Class Permission
10
 *
11
 * @package App\Models
12
 */
13
class Permission extends Model
14
{
15
    use SoftDeletes;
16
17
    /** @var int */
18
    const ID_USERS = 1;
19
20
    /** @var int */
21
    const ID_ROLES = 2;
22
23
    /** @var int */
24
    const ID_TASKS = 3;
25
26
    /** @var bool */
27
    public $timestamps = true;
28
29
    /** @var string */
30
    protected $table = 'permissions';
31
32
    /** @var array */
33
    protected $fillable = [
34
        'name'
35
    ];
36
37
    /** @var array */
38
    protected $visible = [
39
        'id',
40
        'name',
41
        'rolePermissions'
42
    ];
43
44
    /** @var array */
45
    protected $sortable = [
46
        'id',
47
        'name'
48
    ];
49
50
    /** @var array */
51
    protected $searchable = [
52
        'name'
53
    ];
54
55
    /**
56
     * Role permissions.
57
     *
58
     * @return HasMany
59
     */
60
    public function rolePermissions()
61
    {
62
        return $this->hasMany(RolePermission::class, 'permission_id', 'id');
63
    }
64
}
65