title: Laravel @foreach and @forelse
body: <p>I have a problem with my view of laravel. I have a field that executes a loop, and if it has data in the field it list, but if it does not it only shows me nothing.</p>
  
  <p>I used <code>@forelse</code> but it does not work, any help?</p>
  
  <p>with <code>$prices</code> I can check whether or not it has the value, but in that field<code>infos_home</code> does not.
  I used @forelse but it does not work, any help?</p>
  
  <pre><code>&lt;em&gt;{{ $prices-&gt;price ?? ' - ' }}&lt;/em&gt; &lt;br&gt;
  
  @forelse($prices-&gt;infos_home as $info)
      &lt;em&gt;{{ $info }}&lt;/em&gt; &lt;br&gt;
  @empty
      &lt;em&gt; - &lt;/em&gt;
  @endforelse
  </code></pre>
  
  <p></p>
  
  <p>When I use @forelse I have the following error message.</p>
  
  <pre><code>message: "Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: Trying to get property 'infos_home' of non-object (View: C:\wamp64\www\suzuki-cms-backoffice\resources\views\brand\motorcycle\variations\index\column-price.blade.php)"
  </code></pre>