Skip to content

Commit 11cb34f

Browse files
Updated get method in Settings.php to handle default values better (#562)
1 parent 7552867 commit 11cb34f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Settings.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ public function set(string $key, $value): void
1717

1818
public function get(string $key, $default = null): mixed
1919
{
20-
return $this->client->get('settings/'.$key)->json('value') ?? $default;
20+
$response = $this->client->get('settings/'.$key)->json('value');
21+
22+
if ($response === null) {
23+
return $default instanceof \Closure ? $default() : $default;
24+
}
25+
26+
return $response;
2127
}
2228

2329
public function forget(string $key): void

0 commit comments

Comments
 (0)