Passed
Push — master ( e7fb25...290b3a )
by Mohamed
10:38
created

Security_group_user::institution_staff()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Security_group_user extends Model
8
{
9
    public const CREATED_AT = 'created';
10
    public const UPDATED_AT = 'modified';
11
12
    /**
13
     * The database table used by the model.
14
     *
15
     * @var string
16
     */
17
    protected $table = 'security_group_users';
18
19
    /**
20
     * Attributes that should be mass-assignable.
21
     *
22
     * @var array
23
     */
24
    protected $fillable = ['security_group_id', 'security_user_id', 'security_role_id', 'created_user_id', 'created'];
25
26
    /**
27
     * The attributes excluded from the model's JSON form.
28
     *
29
     * @var array
30
     */
31
    protected $hidden = [];
32
33
    /**
34
     * The attributes that should be casted to native types.
35
     *
36
     * @var array
37
     */
38
    protected $casts = [];
39
40
    /**
41
     * The attributes that should be mutated to dates.
42
     *
43
     * @var array
44
     */
45
    protected $dates = ['modified', 'created', 'created'];
46
47
48
    public function security_user(){
49
        return $this->belongsToMany('App\User','security_users');
50
    }
51
52
    public function security_group(){
53
        return $this->hasMany('App\Security_group' , 'id','security_group_id');
54
    }
55
56
    public function security_group_institution(){
57
        return $this->belongsTo('App\Security_group_institution','security_group_id','security_group_id');
58
    }
59
60
    public function staff_class(){
61
        return $this->hasMany('App\Institution_class','staff_id','security_user_id');
62
    }
63
64
    public function institution_staff(){
65
        return $this->belongsTo('App\Institution_staff','security_user_id','staff_id');
66
    }
67
68
    public function institution_group(){
69
        return $this->hasMany('App\Security_group_institution','security_group_id','security_group_id')
70
            ->with(['institution','institution_classes']);
71
    }
72
73
74
    public function roles(){
75
        return $this->belongsTo('App\Security_role','security_role_id','id');
76
    }
77
}
78