db ->table($this->table . " t1") ->where('name', $name); return $builder->get()->getFirstRow(); } /** * Devuelve solo el valor de la variable por nombre */ public function getValue(string $name): ?string { $row = $this->getVariable($name); return $row ? $row->value : null; } /** * Devuelve el valor decodificado (JSON) si aplica */ public function getDecodedValue(string $name): ?array { $value = $this->getValue($name); $decoded = json_decode($value, true); return (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) ? $decoded : null; } /** * Devuelve las opciones disponibles de cabezadas (como array clave => langKey) */ public function getCabezadasDisponibles(): array { return $this->getDecodedValue('cabezadas_disponibles') ?? []; } /** * Devuelve la cabezada por defecto, o 'WHI' si no está definida */ public function getCabezadaDefault(): string { return $this->getValue('cabezada_default') ?? 'WHI'; } }