| Total Complexity | 7 |
| Total Lines | 74 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class ManagerPolicy extends BasePolicy |
||
| 10 | { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Determine whether the user can view the manager. |
||
| 14 | * |
||
| 15 | * @param \App\Models\User $user |
||
|
2 ignored issues
–
show
|
|||
| 16 | * @param \App\Models\Manager $manager |
||
|
2 ignored issues
–
show
|
|||
| 17 | * @return mixed |
||
| 18 | */ |
||
| 19 | public function view(User $user, Manager $manager) |
||
| 20 | { |
||
| 21 | //Manager profiles are viewable by any logged-in user |
||
| 22 | return $user != null; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Determine whether the user can create managers. |
||
| 27 | * |
||
| 28 | * @param \App\Models\User $user |
||
|
2 ignored issues
–
show
|
|||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | public function create(User $user) |
||
| 32 | { |
||
| 33 | // |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Determine whether the user can update the manager. |
||
| 38 | * |
||
| 39 | * @param \App\Models\User $user |
||
|
2 ignored issues
–
show
|
|||
| 40 | * @param \App\Models\Manager $manager |
||
|
2 ignored issues
–
show
|
|||
| 41 | * @return mixed |
||
| 42 | */ |
||
| 43 | public function update(User $user, Manager $manager) |
||
| 44 | { |
||
| 45 | //Mangers can only update their own profiles |
||
| 46 | return $user->user_role->name == 'manager' && |
||
| 47 | $manager->user_id == $user->id; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Determine whether the user can delete the manager. |
||
| 52 | * |
||
| 53 | * @param \App\Models\User $user |
||
|
2 ignored issues
–
show
|
|||
| 54 | * @param \App\Models\Manager $manager |
||
|
2 ignored issues
–
show
|
|||
| 55 | * @return mixed |
||
| 56 | */ |
||
| 57 | public function delete(User $user, Manager $manager) |
||
| 58 | { |
||
| 59 | // |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Determine whether the user can restore the manager. |
||
| 64 | * |
||
| 65 | * @param \App\Models\User $user |
||
|
2 ignored issues
–
show
|
|||
| 66 | * @param \App\Models\Manager $manager |
||
|
2 ignored issues
–
show
|
|||
| 67 | * @return mixed |
||
| 68 | */ |
||
| 69 | public function restore(User $user, Manager $manager) |
||
| 71 | // |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Determine whether the user can permanently delete the manager. |
||
| 76 | * |
||
| 77 | * @param \App\Models\User $user |
||
|
2 ignored issues
–
show
|
|||
| 78 | * @param \App\Models\Manager $manager |
||
|
2 ignored issues
–
show
|
|||
| 79 | * @return mixed |
||
| 80 | */ |
||
| 81 | public function forceDelete(User $user, Manager $manager) |
||
| 83 | // |
||
| 84 | } |
||
| 85 | } |
||
| 86 |