$console = view('editor.default.console.main', ["content" => $elem]);
$console .= '
asdasdasd asd asd jkahsd лофыр вофырвофырв asj dhasjk hdaskj hdaskj dhaskd hask врофылв hask dhj
asdasdasd asd asd jkahsd лофыр вофырвофырв asj dhasjk hdaskj hdaskj dhaskd hask врофылв hask dhj
asdasdasd asd asd jkahsd лофыр вофырвофырв asj dhasjk hdaskj hdaskj dhaskd hask врофылв hask dhj
asdasdasd asd asd jkahsd лофыр вофырвофырв asj dhasjk hdaskj hdaskj dhaskd hask врофылв hask dhj
asdasdasd asd asd jkahsd лофыр вофырвофырв asj dhasjk hdaskj hdaskj dhaskd hask врофылв hask dhj';
namespace App;
use Illuminate\Database\Eloquent\Model;
class Section extends Model
{
protected $casts = [
'elements' => 'array',
];
}
$model = Section::find(1);
$elements = $model->elements;
$elements['param'] = ["TEST" => "TEST"];
$model->elements = $elements;
$model->save();
{"param":{"TEST":"TEST"}}
'elements' => 'array'
Section::where([
"id" => 1
])->update([
"elements->param" => ["TEST" => "TEST"]
]);
"Array to string conversion (SQL: update `sections` set `elements` = json_set(`elements`, '$."param"', TEST), `updated_at` = 2018-07-03 10:29:21 where (`id` = 1) ▶"
class Section extends Model
{
protected $casts = [
'elements' => 'object/array',
];
}
"Array to string conversion (SQL: update `sections` set `elements` = json_set(`elements`, '$."param"', TEST), `updated_at` = 2018-07-03 10:17:38 where (`id` = 1)) ◀"
{"_id": "1", "age": "{\"6\":\"666\"}"}
{"_id": "1", "age": {"6":"666"}}
Section::where([
"id" => 1
])->update([
'data->1->age' => json_encode(['6'=>'666'])
]);
Section::where([
"id" => 1
])->update([
'data' => json_encode(['6'=>'666'])
]);
Section::where([
"id" => 1
])->whereRaw(
'JSON_SET(data, ?)',
'{"_id": "1"}'
)->update([
'data.$.age' => '35'
]);