Laravel external api data extraction

  api, json, laravel, php

Im still new in back-end development and laravel. I’m using Laravel 8.

I want to fetch an api and access only the countries data, I can’t figure out how to access it individually using foreach or any other method.

here is my fetch function:

function countries()
    $data = Http::get('');
    //return json_decode($data);
    return view('v_Country', ['data' => $data]);

how do I access those data in my v_Country view?

Thanks in advance

Source: Laravel

Leave a Reply