I am stuck in Laravel, Need expert's help to resolve the issue.
I have multidimentional array, i am developing the api. I have tried to unset it but somehow it throws the error. I have tried to go with array_filter as well, but not possible for me to resolve the issue.
$data =
Array
(
[dno] => LUCYELEC
[mcu] => 007801714078
[type] => analytic
[start] => 191018120000
[end] => 191020115900
[events] => Array
(
)
)
Array
(
[dno] => LUCYELEC
[mcu] => 106214191003
[type] => analytic
[start] => 191018120000
[end] => 191020115900
[events] => Array
(
[0] => Array
(
[feebbb] => Array
(
[0] => Array
(
[date-time] => 191018080000
[sub-type] => PQ
[comments] => sdfas
[parameter-list] => sdfasd
[state] => bad
[value] => 9200
)
)
)
)
)
There are some [events] are blank, no array. SO i want to remove it and get the only array oject which has data. I need to create this in Loop like forench or for loop.
Response formate in json
return response()->json(['data'=>$data)]);