Created
December 12, 2017 08:04
-
-
Save ryanwinchester/f654824c070b43430ef844b7b5cb6b62 to your computer and use it in GitHub Desktop.
Is it clean?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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