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 b962de9 commit 418572c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ enum AppFeature
}
```

and should be registered in your Provider

```php
class AppServiceProvider extends ServiceProvider
{
//..

public function boot(): void {
AppFeature::defineFeatures();
}
}
```


then, in code, a feature could be checked to be enabled:

Expand Down
5 changes: 5 additions & 0 deletions src/Concerns/DefinesFeatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ public function forget(?Authenticatable $scope = null): void
Pennant::forget($this->featureName());
}

public static function defineFeatures(): void
{
collect(self::cases())->each->define();
}

/**
* @param array<self> $features
*/
Expand Down

0 comments on commit 418572c

Please sign in to comment.