Попытка получить свойство 'stage' необъекта. Как мне решить эту ошибку? Я пробовал различные методы и проверил, что $ doc не пусто.
@foreach ($reports as $report)
<tr>
<td>{{ $report->room_no }}</a></td>
<td>{{ $report->room_type }}</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>{{ $report->price }}</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();
if(isset($doc->pros_name)) {
$n = explode (",",$doc->pros_name);
}
@endphp
@if($doc->stage === "MoveIn")
<td class="text-success"><b>Occupied</b></td>
@else
<td class="text-success"><b>Booked</b></td>
@endif
<td>{{ $report->price }}</td>
<td>{{ $doc->price }}</td>
<td>{{ $n[0] }} {{ $n[1] }} {{ $n[2] }}</td>
@endif
</tr>
@endforeach