mardi 19 novembre 2019

Error Trying to get property 'id' of non-object with data from the API using cURL from ixudra/cURL

I want to display data from the API using the libarary of ixudra / curl, when I try dd he gets the data, but when I try to show in the view there is an error Trying to get property 'id' of non-object this my view code

 @foreach($outputData as $data)
                         
                   @endforeach

this my controller code

       $response = Curl::to('127.0.0.1/user/data')->get();
        $data = json_decode($response, true);    
        $outputData = $data["data"];        
        return view('feature/vendor',compact('outputData'));

if i dd

 $outputData[1];

then output like this

array:6 [▼
  "id" => 3
  "post_id" => 115
  "status" => "active"
  "updated_at" => "2019-11-15 12:57:41"
  "created_at" => "2019-11-15 12:57:41"
]


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire