Completed
Pull Request — master (#8)
by
unknown
01:26
created

Role   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A users() 0 4 1
A permissions() 0 4 1
1
<?php
2
3
namespace Microboard\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
7
use Illuminate\Database\Eloquent\Relations\HasMany;
8
9
class Role extends Model
10
{
11
    /**
12
     * The attributes that are mass assignable.
13
     *
14
     * @var array
15
     */
16
    protected $fillable = [
17
        'name', 'display_name'
18
    ];
19
20
    /**
21
     * The relations to eager load on every query.
22
     *
23
     * @var array
24
     */
25
    protected $with = [
26
        'permissions'
27
    ];
28
29
    /**
30
     * @return HasMany
31
     */
32
    public function users()
33
    {
34
        return $this->hasMany(config('microboard.roles.user', User::class));
35
    }
36
37
    /**
38
     * @return BelongsToMany
39
     */
40
    public function permissions()
41
    {
42
        return $this->belongsToMany(Permission::class);
43
    }
44
}
45