diff --git a/src/Progressable.php b/src/Progressable.php index 4492077..65c1b67 100644 --- a/src/Progressable.php +++ b/src/Progressable.php @@ -178,7 +178,15 @@ protected function getStorageKeyName(): string { * Retrieve the prefix storage key for the PHP function. */ protected function getPrefixStorageKey(): string { - return $this->customPrefixStorageKey ?? config('progressable.prefix', $this->defaultPrefixStorageKey); + if ($this->customPrefixStorageKey !== null) { + return $this->customPrefixStorageKey; + } + + if (function_exists('app') && app()->has('config')) { + return config('progressable.prefix', $this->defaultPrefixStorageKey); + } + + return $this->defaultPrefixStorageKey; } /** @@ -554,7 +562,15 @@ protected function saveOverallProgressData(array $progressData): static { * Get the storage time-to-live in minutes. */ public function getTTL(): int { - return $this->customTTL ?? config('progressable.ttl', $this->defaultTTL); + if ($this->customTTL !== null) { + return $this->customTTL; + } + + if (function_exists('app') && app()->has('config')) { + return config('progressable.ttl', $this->defaultTTL); + } + + return $this->defaultTTL; } /** @@ -606,7 +622,15 @@ public function setTTL(int $TTL): static { * Get the precision for progress values. */ public function getPrecision(): int { - return $this->customPrecision ?? config('progressable.precision', $this->defaultPrecision); + if ($this->customPrecision !== null) { + return $this->customPrecision; + } + + if (function_exists('app') && app()->has('config')) { + return config('progressable.precision', $this->defaultPrecision); + } + + return $this->defaultPrecision; } /**