I am retrieving tracking data from DHL API and the data I am getting is as follows: Data from DHL Tracking API
I use foreach in laravel Blade, the result is this: Foreach
on the bladeHow to create a foreach group in Laravel Blade as follows: View on DHL website
Please help, thank you.
Personally, I would do it all in the controller. Access the api with only the information you need (which looks like more information than you actually need), process that data in the controller and build your own collection, sort and group that data, and send to the frontend. Keep the logic in the controller.
You can use Laravel's collections to group results from the API by date.
But I recommend processing the data in the controller and then sending it to the front end.