Passed
Push — master ( 3b518a...cd2a02 )
by Adam
11:23
created

Role::user()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Coyote\Guide;
4
5
use Coyote\Guide;
6
use Coyote\Models\Scopes\ForUser;
7
use Coyote\User;
8
use Illuminate\Database\Eloquent\Model;
9
10
class Role extends Model
11
{
12
    use ForUser;
13
14
    const JUNIOR = 'junior';
15
    const MID = 'mid';
16
    const SENIOR = 'senior';
17
18
    /**
19
     * The attributes that are mass assignable.
20
     *
21
     * @var array
22
     */
23
    protected $fillable = ['guide_id', 'user_id', 'role'];
24
25
    /**
26
     * The database table used by the model.
27
     *
28
     * @var string
29
     */
30
    protected $table = 'guide_roles';
31
32
    /**
33
     * @var array
34
     */
35
    public $timestamps = false;
36
37
    /**
38
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
39
     */
40
    public function guide()
41
    {
42
        return $this->belongsTo(Guide::class);
43
    }
44
45
    /**
46
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
47
     */
48
    public function user()
49
    {
50
        return $this->belongsTo(User::class)->withTrashed();
51
    }
52
}
53