You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,49 @@ class WalletFunding
84
84
}
85
85
```
86
86
87
+
## Overriding Default Values per Feature
88
+
89
+
If you need more control over the default value of a feature, you can either add a `defaultValue` property.
90
+
91
+
```php
92
+
<?php
93
+
94
+
namespace App\Features;
95
+
96
+
use Stephenjude\FilamentFeatureFlag\Traits\WithFeatureResolver;
97
+
98
+
class WalletFunding
99
+
{
100
+
use WithFeatureResolver;
101
+
102
+
protected bool $defaultValue = false;
103
+
}
104
+
```
105
+
106
+
Or a `defineValue` method.
107
+
108
+
```php
109
+
<?php
110
+
111
+
namespace App\Features;
112
+
113
+
use Stephenjude\FilamentFeatureFlag\Traits\WithFeatureResolver;
114
+
115
+
class WalletFunding
116
+
{
117
+
use WithFeatureResolver;
118
+
119
+
protected function defaultValue(mixed $scope): bool
120
+
{
121
+
return false;
122
+
}
123
+
}
124
+
```
125
+
126
+
The result of these methods will get cast to a boolean.
127
+
128
+
If neither are defined, the default value gets fetched from the `filament-feature-flags.default` config entry.
129
+
87
130
## Feature Segmentation
88
131
By default, this package resolves scope using the `App\Models\User` model and the default segment applies features for individual or group of users by email.
0 commit comments