iam trying to pass $data array to save it in the laravel storage files my code is :
$data = '[
{
"label": " Total Accidents",
"color": "#5ab1ef",
"data":
[
["Jan",0],
["Feb",0],
["Mar",0],
["Apr",0],
["May",0],
["Jun",0],
["Jul",0],
["Aug",0],
["Sep",0]
]
},
{
"label": " Active Experts",
"color": "#f5994e",
"data":
[
["Jan",0],
["Feb",0],
["Mar",0],
["Apr",0],
["May",0],
["Jun",0],
["Jul",0],
["Aug",0],
["Sep",0]
]
},
{
"label": " Pending Payments",
"color": "#d87a80",
"data":
[
["Jan",0],
["Feb",0],
["Mar",0],
["Apr",0],
["May",0],
["Jun",0],
["Jul",0],
["Aug",0],
["Sep",0]
]
}
]';
$test = json_decode($data, true);
$test[0]['data'][1] = ["Jan", 153];
Storage::disk('chartData')
->put('chart/test'.$_SESSION['companyId'].'.json', $test);
return 'done';
i want to change the values inside each year according to database values , the problem is that when iam trying to put method iam getting the following error :
Array to string conversion
if i pass $data array without doing json_decode it works fine , but in this case i cant change the data isnide the array , so i have to decode it .