I have the following foreach loop in my blade which is showing error:
trying to get property 'pros_name' of non-object
How do I resolve it?
@foreach ($reports as $report)
<tr>
<td></a></td>
<td></td>
@if($report->book_date== null || ($report->book_date != null && ($report->release_date != null && $report->release_date < date('Y-m-d'))))
<td class="text-danger"><strong>Vacant</strong></td>
<td></td>
<td>---</td>
<td></td>
@endif
@if($report->book_date != null && ( $report->release_date ==null || $report->release_date >= date('Y-m-d')))
@php
$doc = DB::table('gen_resident_room')
->Join('sales_pipeline', 'gen_resident_room.person_id', '=', 'sales_pipeline.id')
->where([['room_id',$report->room_id]])->first();
$n = explode (",",$doc->pros_name); //error
@endphp
@if($doc->stage === "MoveIn")
<td class="text-success"><b>Occupied</b></td>
@else
<td class="text-success"><b>Booked</b></td>
@endif
<td></td>
<td></td>
<td> </td>
@endif
</tr>
@endforeach
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire