| Total Complexity | 6 | 
| Total Lines | 18 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 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); | ||
|  | |||
| 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); | ||
| 19 | } | ||
| 20 | |||
| 21 | public function restore($user, Post $post): bool | ||
| 25 | } | ||
| 26 | } | ||
| 27 | 
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.