Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona committed Apr 19, 2024
1 parent 8d51331 commit 5469b54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ enum AppFeature
/* Feature resolution */

//with a single method:
protected function resolve(?Authenticatable $user = null) {
$user ??= auth()->user();

protected function resolve(Authenticatable $user = null) {
match($this){
case self::multi_language => true,
case self::impersonate => $user->isAdmin(),
Expand All @@ -53,9 +51,7 @@ enum AppFeature

//or with a dedicated method:

protected function resolveImpersonate(?Authenticatable $user = null){
$user ??= auth()->user();

protected function resolveImpersonate(Authenticatable $user = null){
return $user->isSuperAdmin();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/DefinesFeatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function purge(): void
Pennant::purge($this->featureName());
}

protected function resolve(?Authenticatable $scope = null): bool
protected function resolve(Authenticatable $scope = null): bool
{
$featureName = $this->featureName();
$camelFeatureName = str($this->featureName())->camel()->ucfirst();
Expand Down

0 comments on commit 5469b54

Please sign in to comment.