Skip to content

Instantly share code, notes, and snippets.

@ryanwinchester
Created December 12, 2017 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanwinchester/f654824c070b43430ef844b7b5cb6b62 to your computer and use it in GitHub Desktop.
Save ryanwinchester/f654824c070b43430ef844b7b5cb6b62 to your computer and use it in GitHub Desktop.
Is it clean?
<?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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment