1 | <?php |
||
41 | class Employee extends Model implements AuthenticatableContract, |
||
42 | AuthorizableContract, |
||
43 | CanResetPasswordContract, |
||
44 | PolicyCheckable |
||
45 | { |
||
46 | use Authenticatable, Authorizable, CanResetPassword; |
||
47 | |||
48 | /** |
||
49 | * The attributes that are mass assignable. |
||
50 | * |
||
51 | * @var array |
||
52 | */ |
||
53 | protected $fillable = ['name', 'email', 'password']; |
||
54 | |||
55 | /** |
||
56 | * The attributes excluded from the model's JSON form. |
||
57 | * |
||
58 | * @var array |
||
59 | */ |
||
60 | protected $hidden = ['password', 'remember_token', 'pivot']; |
||
61 | |||
62 | /** |
||
63 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
64 | */ |
||
65 | 2 | public function company() |
|
69 | |||
70 | /** |
||
71 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
72 | */ |
||
73 | 18 | public function groups() |
|
77 | |||
78 | /** |
||
79 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
80 | */ |
||
81 | 12 | public function calendars() |
|
85 | |||
86 | /** |
||
87 | * Get the e-mail address where password reset links are sent. |
||
88 | * This is needed for multiple user type login |
||
89 | * |
||
90 | * Make email unique |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | 2 | public function getEmailForPasswordReset() |
|
108 | |||
109 | /** |
||
110 | * @param Group $group |
||
111 | * @return bool |
||
112 | */ |
||
113 | 8 | public function belongsToGroup(Group $group) |
|
120 | |||
121 | /* |
||
122 | * for a normal employee the policyCheckable methods say if the employee can se or not the element |
||
123 | */ |
||
124 | |||
125 | /** |
||
126 | * @param Group $group |
||
127 | * @return bool |
||
128 | */ |
||
129 | 4 | public function verifyGroup(Group $group) |
|
133 | |||
134 | /** |
||
135 | * @param Employee $employee |
||
136 | * @return bool |
||
137 | */ |
||
138 | public function verifyEmployee(Employee $employee) |
||
142 | |||
143 | /** |
||
144 | * @param Company $company |
||
145 | * @return bool |
||
146 | */ |
||
147 | public function verifyCompany(Company $company) |
||
151 | |||
152 | /** |
||
153 | * the employee can modify a calendar |
||
154 | * @param Calendar $calendar |
||
155 | * @return bool |
||
156 | */ |
||
157 | 8 | public function verifyCalendar(Calendar $calendar) |
|
162 | } |
||
163 |