NNTmux /
newznab-tmux
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Policies; |
||
| 4 | |||
| 5 | use TeamTeaTime\Forum\Models\Post; |
||
| 6 | |||
| 7 | class PostPolicy extends \TeamTeaTime\Forum\Policies\PostPolicy |
||
| 8 | { |
||
| 9 | public function edit($user, Post $post): bool |
||
| 10 | { |
||
| 11 | // Admins can edit any post; users can edit their own |
||
| 12 | return $user->hasRole('Admin') || ($user->getKey() === $post->author_id); |
||
|
0 ignored issues
–
show
|
|||
| 13 | } |
||
| 14 | |||
| 15 | public function delete($user, Post $post): bool |
||
| 16 | { |
||
| 17 | // Admins can delete any post; users can delete their own |
||
| 18 | return $user->hasRole('Admin') || ($user->getKey() === $post->author_id); |
||
|
0 ignored issues
–
show
|
|||
| 19 | } |
||
| 20 | |||
| 21 | public function restore($user, Post $post): bool |
||
| 22 | { |
||
| 23 | // Admins can restore any post; users can restore their own |
||
| 24 | return $user->hasRole('Admin') || ($user->getKey() === $post->author_id); |
||
|
0 ignored issues
–
show
|
|||
| 25 | } |
||
| 26 | } |
||
| 27 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.