1Once the cast is defined, you may access
2 the options attribute and
3 it will automatically be deserialized
4 from JSON into a PHP array. When you set
5 the value of the options attribute, the given
6 array will automatically be serialized back into
7 JSON for storage:
8
9
10use App\Models\User;
11
12$user = User::find(1);
13
14$options = $user->options;
15
16$options['key'] = 'value';
17
18$user->options = $options;
19
20$user->save();