Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function canView(string $scope, int $owner_id): bool
- {
- return $scope === 'public' || $this->userCanView(Auth::user(), $owner_id);
- }
- function userCanView(User $user, int $owner_id): bool
- {
- return $user->hasRole('admin') || $user->id === $owner_id;
- }
Add Comment
Please, Sign In to add comment