Completed
Push — master ( f65d8f...4f3de5 )
by Pavel
04:14 queued 01:54
created

Role   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A rights() 0 4 1
1
<?php
2
namespace App\Model;
3
4
use Illuminate\Database\Eloquent\SoftDeletes;
5
6
/**
7
 * Class Role
8
 *
9
 * @property integer        $id
10
 * @property string         $name
11
 * @property string         $description
12
 * @property integer        $created_by
13
 * @property integer        $updated_by
14
 * @property \Carbon\Carbon $created_at
15
 * @property \Carbon\Carbon $updated_at
16
 * @property \Carbon\Carbon $deleted_at
17
 * @property-read Right[]   $rights
18
 *
19
 * @package App\Model
20
 */
21
final class Role extends BaseModel
22
{
23
24
    use SoftDeletes;
25
26
    protected $table = 'roles';
27
28
    protected $fillable = [
29
        'name',
30
        'description',
31
    ];
32
33
    public static $rules = [
34
        'name' => 'required',
35
    ];
36
37
    public function rights()
38
    {
39
        return $this->belongsToMany('App\Model\Right', 'roles_to_rights', 'role_id', 'right_id');
40
    }
41
42
}
43