@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 "ABORDAJE"; } elseif ($estado == 2) { return "LA PAZ"; } elseif ($estado == 3) { return "---"; } elseif ($estado == 0) { return "SALIO"; } } @endphp @foreach($salidas as $key => $salida) @foreach(\App\Models\Empresa::where("id", $salida->id_empresa)->get() as $empresa) @if ($empresa->logo) Logo @else Image @endif @endforeach {{ formatHora($salida->hora) }} @foreach(\App\Models\Destino::where("id", $salida->id_destino)->get() as $destino) {{ $destino->name }} @endforeach {{ getPuertaCarrilInfo($salida->id_puerta, $salida->id_carril) }} {!! getEstadoSpan($salida->estado) !!} @endforeach