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