Skip to content

Commit 8131d17

Browse files
committed
wip
1 parent 91e9e4b commit 8131d17

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

eloquent-mutators.md

+19
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,25 @@ $user = User::find(1);
364364
$user->update(['options->key' => 'value']);
365365
```
366366

367+
<a name="json-and-unicode"></a>
368+
#### JSON and Unicode
369+
370+
If you would like to store an array attribute as JSON with unescaped Unicode characters, you may use the `json:unicode` cast:
371+
372+
```php
373+
/**
374+
* Get the attributes that should be cast.
375+
*
376+
* @return array<string, string>
377+
*/
378+
protected function casts(): array
379+
{
380+
return [
381+
'options' => 'json:unicode',
382+
];
383+
}
384+
```
385+
367386
<a name="array-object-and-collection-casting"></a>
368387
#### Array Object and Collection Casting
369388

0 commit comments

Comments
 (0)