1 | <?php |
||
35 | class Planner extends Employee |
||
36 | { |
||
37 | |||
38 | 6 | public function groupsManaged() |
|
39 | { |
||
40 | 6 | return $this->HasMany(Group::class); |
|
41 | } |
||
42 | |||
43 | /* |
||
44 | * for a planer employee the policyCheckable methods say if the planer can modify or not that part |
||
45 | */ |
||
46 | |||
47 | /** |
||
48 | * @param Group $group |
||
49 | * @return bool |
||
50 | */ |
||
51 | 4 | public function verifyGroup(Group $group) |
|
52 | { |
||
53 | 4 | $group = $this->groupsManaged()->where('id', $group->id)->first(); |
|
54 | |||
55 | 4 | return (is_object($group) && $group->exists); |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @param Employee $employee |
||
60 | * @return bool |
||
61 | */ |
||
62 | public function verifyEmployee(Employee $employee) |
||
68 | |||
69 | /** |
||
70 | * @param Company $company |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function verifyCompany(Company $company) |
||
77 | |||
78 | /** |
||
79 | * the employee can see a calendar |
||
80 | * @param Calendar $calendar |
||
81 | * @return bool |
||
82 | */ |
||
83 | public function verifyCalendar(Calendar $calendar) |
||
88 | } |
||
89 |