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
+21-19Lines changed: 21 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,15 @@ Laravel-flagsmith was created by, and is maintained by **[Andrew Nagy](https://g
10
10
11
11
## Features
12
12
13
-
- Provides a trait to be able to get features based on Laravel Users ([Flagsmith Identities](https://docs.flagsmith.com/basic-features/managing-identities))
14
-
- Utilizes [Laravel's Queue](https://laravel.com/docs/8.x/queues) system to update features in the background
15
-
- Utilizes [Laravel's Cache](https://laravel.com/docs/8.x/cache) system to store features in a cache for quick access
16
-
- Utilizes [Laravel's Task Scheduling](https://laravel.com/docs/8.x/scheduling) system to update features on a schedule
17
-
- Adds a route to utilize [Flagsmith's webhooks](https://docs.flagsmith.com/advanced-use/system-administration) to update the cache when features change
13
+
-Provides a trait to be able to get flags based on Laravel Users ([Flagsmith Identities](https://docs.flagsmith.com/basic-features/managing-identities))
14
+
-Utilizes [Laravel's Queue](https://laravel.com/docs/8.x/queues) system to update flags in the background
15
+
-Utilizes [Laravel's Cache](https://laravel.com/docs/8.x/cache) system to store flags in a cache for quick access
16
+
-Utilizes [Laravel's Task Scheduling](https://laravel.com/docs/8.x/scheduling) system to update flags on a schedule
17
+
-Adds a route to utilize [Flagsmith's webhooks](https://docs.flagsmith.com/advanced-use/system-administration) to update the cache when flags change
- Publish the Laravel Flagsmith configuration file using the `vendor:publish` Artisan command. The `flagsmith` configuration file will be placed in your `config` directory (Use `--force` to overwrite your existing `clearly` config file):
-Publish the Laravel Flagsmith configuration file using the `vendor:publish` Artisan command. The `flagsmith` configuration file will be placed in your `config` directory (Use `--force` to overwrite your existing `clearly` config file):
All options are fully documented in the configuration file
45
45
46
46
### User
47
47
48
-
It's advised to add the trait`Clearlyip\LaravelFlagsmith\Concerns\HasFeatures` to your user model. This will give you the ability to access features directly from your user object.
48
+
It's advised to add the interface`Clearlyip\LaravelFlagsmith\Contracts\UserFlags` to your user model. This will give you the ability to access flags directly from your user object.
49
49
50
-
During inital login user features are synced through a queue which keeps them as up to date as possible
50
+
You can add the following trait `Clearlyip\LaravelFlagsmith\Concerns\HasFlagss` to your user model to fulfill the requirements of `UserFlags`
51
51
52
-
#### List All Features for a User
52
+
During initial login user flags are synced through a queue which keeps them as up to date as possible
53
+
54
+
#### Get All Flags for a User
53
55
54
56
```php
55
57
$user = Auth::user();
56
-
$features = $user->getFeatures();
58
+
$flags = $user->getFlags();
57
59
```
58
60
59
-
### Check if feature is enabled for a user
61
+
### Check if flag is enabled for a user
60
62
61
-
An optional second parameter can be added as the default if the feature does not exist
63
+
An optional second parameter can be added as the default if the flag does not exist
62
64
63
65
```php
64
66
$user = Auth::user();
65
-
$features = $user->isFeatureEnabled('foo');
67
+
$flags = $user->isFlagEnabled('foo');
66
68
```
67
69
68
-
#### Get a Features value for a User
70
+
#### Get a Flag value for a User
69
71
70
-
An optional second parameter can be added as the default if the feature does not exist
72
+
An optional second parameter can be added as the default if the flag does not exist
<!-- This option is good for inspecting extended methods, however using ReflectionClass may cause phpcs crashes while editing (not possible to catch FatalError). -->
0 commit comments