0

Here is an image showing the json object being recieved

I pefromed the following loop on the view but i am getting the following error. Trying to get property 'article' of non-object

  @foreach ($news as $key => $value)
        {{$value->article}}
      @endforeach
Vanye Wadawasina
  • 27
  • 1
  • 1
  • 6

1 Answers1

0

"->" just work on objects , if you are using an array shuld use "$value['article']" to get value

@foreach ($news['articles'] as $key => $value)
        {{$value['content']}}
@endforeach

also may your $value is an object but article key not exist on it.

Convert Array to Object

faryar76
  • 130
  • 1
  • 8