zaster
148
2
Laravel

@if - Trying to get property 'id' of non-object

Posted 2 months ago by zaster
<td>{{$po_item->vendor_company->name}}
   @if($po_item->po->id)
     <a href="{{route('employee.po.show', $po_item->po->id)}}"> PO No : {{$po_item->po->id}}</a> 
    @endif
</td> 

When a po_id is not assigned to the $po_item I am getting

 Trying to get property 'id' of non-object

How can i avoid this

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.