why are you doing this ?
$header = json_decode(json_encode($header), true);
you can simply check if it has records using !is_null or $header->count() or you can do $header instanceOf Illuminate\Support\Collection
you have so many loops, why not use a join statement and let mysql do the calculations for you.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community