Guest User

Untitled

a guest
Dec 14th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. <?php
  2.  
  3. function canView(string $scope, int $owner_id): bool
  4. {
  5. return $scope === 'public' || $this->userCanView(Auth::user(), $owner_id);
  6. }
  7.  
  8. function userCanView(User $user, int $owner_id): bool
  9. {
  10. return $user->hasRole('admin') || $user->id === $owner_id;
  11. }
Add Comment
Please, Sign In to add comment