Skip to content

Commit fdcffc3

Browse files
committed
Implement docs suggestions
1 parent bd755bd commit fdcffc3

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,28 +85,31 @@ service('setting')->forget('App.siteName')
8585
In addition to the default behavior describe above, `Settings` can can be used to define "contextual settings".
8686
A context may be anything you want, but common examples are a runtime environment or an authenticated user.
8787
In order to use a context you pass it as an additional parameter to the `get()`/`set()`/`forget()` methods; if
88-
a context setting is requested and does not exist then the default global value will be used.
88+
a context setting is requested and does not exist then the general value will be used.
8989

9090
Contexts may be any unique string you choose, but a recommended format for supplying some consistency is to
91-
given them a category and identifier, like `environment:production` or `group:42`.
91+
give them a category and identifier, like `environment:production` or `group:42`.
9292

9393
An example... Say your App config includes the name of a theme to use to enhance your display. By default
9494
your config file specifies `App.theme = 'default'`. When a user changes their theme, you do not want this to
9595
change the theme for all visitors to the site, so you need to provide the user as the *context* for the change:
9696

9797
```php
98-
$context = 'user:' . user_id();
99-
service('setting')->set('App.theme', 'dark', $context);
98+
$context = 'user:' . user_id();
99+
service('setting')->set('App.theme', 'dark', $context);
100100
```
101101

102102
Now when your filter is determining which theme to apply it can check for the current user as the context:
103103

104104
```php
105-
$context = 'user:' . user_id();
106-
$theme = service('setting')->get('App.theme', $context);
105+
$context = 'user:' . user_id();
106+
$theme = service('setting')->get('App.theme', $context);
107+
108+
// or using the helper
109+
setting()->get('App.theme', $context);
107110
```
108111

109-
If that context is not found the library falls back to the global value, i.e. `service('setting')->get('App.theme')`
112+
If that context is not found the library falls back to the general value, i.e. `service('setting')->get('App.theme')`
110113

111114
### Using the Helper
112115

UPGRADING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Upgrade Guide
2+
3+
## Version 1 to 2
4+
***
5+
6+
* Due to the addition of contexts the `BaseHandler` abstract class was changed. Update any handlers that extend this class to include the new and changed methods.

0 commit comments

Comments
 (0)