Skip to content

Commit 9371cf0

Browse files
committed
Update documentation
1 parent 718767e commit 9371cf0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ app()->setLocale('fr_FR');
113113
var_dump($post->title); // "Bonjour le monde"
114114
```
115115

116+
Alternatively, you can use the `withLocale` method to retrieve the translated model for a specific locale:
117+
118+
```php
119+
var_dump($post->withLocale('fr_FR')->title); // "Bonjour le monde"
120+
121+
// Current locale is reset to default afterwards
122+
var_dump($post->title); // "Hello World"
123+
```
124+
116125
## Testing
117126
The package includes tests that you can run using `PHPUnit`:
118127

0 commit comments

Comments
 (0)