{{-- Where this admission came from: a link back to the appointment or the emergency visit (its labs, medication, orders, vitals and bill stay there). --}} @php $originEm = \App\Models\Emergency::where('admission_id', $admission->id)->latest('id')->first(); $originApp = $admission->type == 'appointment' ? $admission->Appointment : null; @endphp @if ($originEm || $originApp)