|
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
|
|
|
|