title: Display list of purchase order base from filtered vendor in Laravel eloquent
body: <p>I am trying to display the list of vendor with their purchase orders in a table. </p>
  
  <p>VENDOR MODEL</p>
  
  <pre><code>public function vendorPo()
  {
      return $this-&gt;hasMany('App\PurchasedOrder', 'vendor_id','vendor_id');
  }
  </code></pre>
  
  <p>VENDOR CONTROLLER</p>
  
  <pre><code>public function vendor()
  {
      $vendorPo = Vendor::with('vendorPo')
          -&gt;get()
          -&gt;keyBy('id')
          -&gt;groupBy('vendor_name');
  
      $purchaseOrders = PurchasedOrder::all()-&gt;where('publish','=','1');
  
      return view('backend.purchase-order.vendor', compact('purchaseOrders'))
              -&gt;with('vendorPo', $vendorPo);
  }
  </code></pre>
  
  <p>for my index</p>
  
  <pre><code>@foreach ($vendorPo as $vendor =&gt; $vendor_list)
      &lt;tr&gt;
          &lt;th colspan="7"
              style="background-color: #F7F7F7"&gt; {{ $vendor }}: ({{ $vendor_list-&gt;count() }} vendors)
          &lt;/th&gt;
      &lt;/tr&gt;
          @foreach ($vendor_list as $key =&gt; $vendorPoList)
          &lt;tr&gt;
              &lt;td&gt;
                  {{ $vendorPoList-&gt;vendorPo-&gt;po_id}}
              &lt;/td&gt;
          &lt;/tr&gt;
          @endforeach
  @endforeach
  </code></pre>
  
  <p>if I do this                              </p>
  
  <pre><code>...
  @foreach ($vendor_list as $key =&gt; $vendorPoList)
       &lt;tr&gt;
          &lt;td&gt;
              {{ $vendorPoList}}
          &lt;/td&gt;
       &lt;/tr&gt;
  @endforeach
  ...
  </code></pre>
  
  <p>the result is this
  <a href="https://i.stack.imgur.com/HxFW6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HxFW6.png" alt="enter image description here"></a></p>
  
  <p>and if I</p>
  
  <pre><code>...
  &lt;td&gt;
       {{ $vendorPoList-&gt;vendorPO-&gt;po_id}}}
  &lt;/td&gt;
  ...
  </code></pre>
  
  <p>the result is error</p>
  
  <pre><code>Facade\Ignition\Exceptions\ViewException
  Property [po_id] does not exist on this collection instance. (View: 
  </code></pre>
  
  <p>Please help me. Thanks!</p>