orderBy('created_at', 'desc') ->pluck('path') ->first(); $registros = CsvHelper::getRecords($ultimaCanasta, "No se encontrĂ³ la ultima canasta."); $error = 'No hay fila de tipo T en la planilla: ' . $ultimaCanasta; foreach ($registros as $key => $registro) if ($registro[CanastaHelper::TIPO] == 'T') return $key; Log::error($error); throw new Exception($error); } /** * @throws Exception */ public static function getParametro(string $id): int { if (self::$parametros === null) { $records = CsvHelper::getRecords(resource_path('csv/parametros.csv'), "No se pudo leer el archivo."); self::$parametros = []; foreach ($records as $row) { self::$parametros[$row['id']] = $row; } } if (!isset(self::$parametros[$id])) { throw new InvalidArgumentException("ParĂ¡metro '$id' no encontrado."); } return (int) self::$parametros[$id]['valor']; } public static function resetParametros(): void { self::$parametros = null; } }