From c6c04da5c4893f79c4bf2ddc70a5bed84dae3f81 Mon Sep 17 00:00:00 2001 From: AJ Meireles Date: Tue, 22 Apr 2025 13:04:01 -0300 Subject: [PATCH] Updated get method in Settings.php to handle default values better --- src/Settings.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Settings.php b/src/Settings.php index e849c72..ddcc030 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -17,7 +17,13 @@ public function set(string $key, $value): void public function get(string $key, $default = null): mixed { - return $this->client->get('settings/'.$key)->json('value') ?? $default; + $response = $this->client->get('settings/'.$key)->json('value'); + + if ($response === null) { + return $default instanceof \Closure ? $default() : $default; + } + + return $response; } public function forget(string $key): void