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: docs/basic-usage.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,13 +30,32 @@ when retrieved.
30
30
service('settings')->set('App.siteName', 'My Great Site');
31
31
```
32
32
33
+
You can save multiple values with `setMany()`. This behaves like calling `set()` for each key/value pair,
34
+
but allows supported handlers to persist the changes more efficiently.
35
+
36
+
```php
37
+
service('settings')->setMany([
38
+
'App.siteName' => 'My Great Site',
39
+
'App.siteEmail' => 'support@example.com',
40
+
]);
41
+
```
42
+
33
43
You can delete a value from the persistent storage with the `forget()` method. Since it is removed from the storage,
34
44
it effectively resets itself back to the default value in config file, if any.
35
45
36
46
```php
37
47
service('settings')->forget('App.siteName');
38
48
```
39
49
50
+
You can delete multiple values with `forgetMany()`.
51
+
52
+
```php
53
+
service('settings')->forgetMany([
54
+
'App.siteName',
55
+
'App.siteEmail',
56
+
]);
57
+
```
58
+
40
59
If you ever need to completely remove all settings from their persistent storage, you can use the `flush()` method. This immediately removes all settings from the database and the in-memory cache.
0 commit comments