Skip to content

Commit 05eaeaa

Browse files
[10.x] Documents passing array to for (#8556)
* Documents passing array for `for` * Update pennant.md --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 5252f1d commit 05eaeaa

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pennant.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,25 @@ if (Feature::for($user->team)->active('billing-v2')) {
380380
// ...
381381
```
382382

383+
The `for` method also accepts an array of scopes, which will check that the feature is active for all of the provided scopes:
384+
385+
```php
386+
Feature::define('improved-notifications', function (string $email) {
387+
return str_ends_with($email, '@example.com');
388+
});
389+
390+
Feature::for([
391+
392+
393+
])->active('improved-notifications');
394+
395+
// false
396+
```
397+
383398
<a name="default-scope"></a>
384399
### Default Scope
385400

386-
It is also possible to customize the default scope Pennant uses to check features. For example, maybe all of your features are checked against the currently authenticated user's team instead of the user. Instead of having to call `Feature::for($user->team)` every time you check a feature, you may instead specify the team as the default scope. Typically, this should be done in one of your application's service providers:
401+
Sometimes, you may need to customize the default scope Pennant uses to check features. For example, maybe all of your features are checked against the currently authenticated user's team instead of the user. Instead of having to call `Feature::for($user->team)` every time you check a feature, you may instead specify the team as the default scope. Typically, this should be done in one of your application's service providers:
387402

388403
```php
389404
<?php

0 commit comments

Comments
 (0)