| Total Complexity | 5 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class DiscussPostPolicy |
||
| 12 | { |
||
| 13 | use HandlesAuthorization; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Authorize all actions if the user has the given permission. |
||
| 17 | * |
||
| 18 | * @param User $user |
||
| 19 | * @param string $ability |
||
| 20 | * |
||
| 21 | * @return true|void |
||
| 22 | */ |
||
| 23 | public function before(User $user, string $ability) |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Determine whether the user can create a discuss post. |
||
| 32 | * |
||
| 33 | * @param User $user |
||
| 34 | * |
||
| 35 | * @return bool |
||
| 36 | */ |
||
| 37 | public function create(User $user): bool |
||
| 38 | { |
||
| 39 | return $user->hasPermissionTo('create discuss post'); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Determine whether the user can update the discuss post. |
||
| 44 | * |
||
| 45 | * @param User $user |
||
| 46 | * @param DiscussPost $discussPost |
||
| 47 | * |
||
| 48 | * @return bool |
||
| 49 | */ |
||
| 50 | public function update(User $user, DiscussPost $discussPost) |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Determine whether the user can delete the discuss post. |
||
| 57 | * |
||
| 58 | * @param User $user |
||
| 59 | * @param DiscussPost $discussPost |
||
| 60 | * |
||
| 61 | * @return bool |
||
| 62 | */ |
||
| 63 | public function delete(User $user, DiscussPost $discussPost) |
||
| 68 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.