Skip to content

Commit

Permalink
Update basic usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rawilk committed Sep 28, 2023
1 parent 38367ad commit 025528a
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/basic-usage/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,40 @@ Settings::isFalse('app.debug'); // false
Settings::set('app.debug', false);
Settings::isFalse('app.debug'); // true
```

## Retrieve all settings

Using `all`, you can retrieve all the stored settings, which will be returned as a collection. You may also retrieve a subset of settings
by passing in an array of keys to retrieve.

```php
Settings::all();

// Subset of settings
Settings::all(['foo', 'bar']);
```

The collection of settings returned from this method will contain objects structured like this:

```json
{
"id": 1,
"key": "foo",
"value": "bar",
"original_key": "foo"
}
```

> {info} The `original_key` property is set by settings to reflect the key that is used in the database.
## Flushing settings

Multiple settings can be deleted at one time using the `flush` method on settings. It works similar to `forget`, however
it is not able to flush the cache for each setting, unless you pass in a subset of keys to flush.

```php
Settings::flush();

// Flush a subset of settings
Settings::flush(['foo', 'bar']);
```

0 comments on commit 025528a

Please sign in to comment.