@php function getEmpresaName($id) { $empresa = \App\Models\Empresa::find($id); return strtoupper($empresa->name); } function formatHora($hora) { $dateNew = strtotime($hora); return date('H:i', $dateNew); } function getDestinoName($id) { $destino = \App\Models\Destino::find($id); return $destino->name; } function getPuertaCarrilInfo($idPuerta, $idCarril) { $puerta = \App\Models\Puerta::find($idPuerta); $carril = \App\Models\Carril::find($idCarril); return "{$puerta->name}/{$carril->name}"; } function getEstadoSpan($estado) { if ($estado == 1) { return "ARRIBO"; } elseif ($estado == 2) { return "LLEGANDO"; } elseif ($estado == 3) { return "---"; } elseif ($estado == 0) { return "EN CAMINO"; } } @endphp @foreach($llegadas as $key => $llegada) @foreach(\App\Models\Empresa::where("id", $llegada->id_empresa)->get() as $empresa) @if ($empresa->logo) Logo @else Image @endif @endforeach {{ formatHora($llegada->hora) }} @foreach(\App\Models\Destino::where("id", $llegada->id_destino)->get() as $destino) {{ $destino->name }} @endforeach {{ getPuertaCarrilInfo($llegada->id_puerta, $llegada->id_carril) }} {!! getEstadoSpan($llegada->estado) !!} @endforeach