Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.