Код: Выделить всё
{"email":{"subscriptions":"{\"Foo\":true,\"Bar\":false}"}}
Код: Выделить всё
{\"Foo\":true,\"Bar\":false}"}
Код: Выделить всё
$user = auth()->user();
$array = json_decode($user->preferences['email']['subscriptions'], true);
dd($array);
Код: Выделить всё
array:2 [
"Foo" => true
"Bar" => false
]
Код: Выделить всё
$preferences = array_merge($array, $request->all());
dd($preferences);
Код: Выделить всё
array:2 [
"Foo" => true
"Bar" => true
]
Код: Выделить всё
$user->update(compact('preferences'));
Код: Выделить всё
{"Foo":true,"Bar":true}
Я пробовал это:
Код: Выделить всё
$user->update([$user->preferences['email']['subscriptions'] => json_encode($preferences)]);
Подробнее здесь: https://stackoverflow.com/questions/586 ... son-object
Мобильная версия