fixed default return
This commit is contained in:
parent
252ff287de
commit
c60e2504b9
|
|
@ -9,12 +9,12 @@ trait Settings
|
||||||
{
|
{
|
||||||
use Companies;
|
use Companies;
|
||||||
|
|
||||||
public function getSettingValue(string $key, mixed $default = ''): mixed
|
public function getSettingValue(string $key, mixed $default = null): mixed
|
||||||
{
|
{
|
||||||
$settings = setting()->all();
|
$settings = setting()->all();
|
||||||
|
|
||||||
if (! empty($settings)) {
|
if (! empty($settings)) {
|
||||||
return setting($key);
|
return setting($key, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
$company_id = $this->getCompanyId();
|
$company_id = $this->getCompanyId();
|
||||||
|
|
@ -23,6 +23,8 @@ trait Settings
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Setting::companyId($company_id)->where('key', $key)->pluck('value')->first();
|
$value = Setting::companyId($company_id)->where('key', $key)->pluck('value')->first();
|
||||||
|
|
||||||
|
return $value ?: $default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,6 @@ class Info
|
||||||
{
|
{
|
||||||
$setting = new class() { use Settings; };
|
$setting = new class() { use Settings; };
|
||||||
|
|
||||||
return $setting->getSettingValue('apps.api_key');
|
return $setting->getSettingValue('apps.api_key', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue