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

Role::rights()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
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