| Total Complexity | 4 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class LocationPolicy |
||
| 10 | { |
||
| 11 | use HandlesAuthorization; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Determine whether the user can view the location. |
||
| 15 | * |
||
| 16 | * @param \App\User $user |
||
| 17 | * @return bool |
||
| 18 | */ |
||
| 19 | public function view(User $user) : bool |
||
| 20 | { |
||
| 21 | // Locations can be viewed by administrators and viewers. |
||
| 22 | return $user->role !== User::ROLE_STUDENT; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Determine whether the user can create locations. |
||
| 27 | * |
||
| 28 | * @param \App\User $user |
||
| 29 | * @return bool |
||
| 30 | */ |
||
| 31 | public function create(User $user) : bool |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Determine whether the user can update locations. |
||
| 38 | * |
||
| 39 | * @param \App\User $user |
||
| 40 | * @return bool |
||
| 41 | */ |
||
| 42 | public function update(User $user) : bool |
||
| 43 | { |
||
| 44 | return $user->role !== User::ROLE_STUDENT; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Determine whether the user can delete the location. |
||
| 49 | * |
||
| 50 | * @param \App\User $user |
||
| 51 | * @return bool |
||
| 52 | */ |
||
| 53 | public function delete(User $user) : bool |
||
| 56 | } |
||
| 57 | |||
| 58 | } |
||
| 59 |