mirror of
https://github.com/cp6/my-idlers.git
synced 2025-04-19 09:38:36 +00:00
Fix for settings not existing
This commit is contained in:
parent
cd41dcdfff
commit
1aab332ef8
1 changed files with 4 additions and 0 deletions
|
@ -18,6 +18,10 @@ class Settings extends Model
|
||||||
public static function getSettings(): Settings
|
public static function getSettings(): Settings
|
||||||
{
|
{
|
||||||
return Cache::remember('settings', now()->addWeek(1), function () {
|
return Cache::remember('settings', now()->addWeek(1), function () {
|
||||||
|
$settings = self::where('id', 1)->first();
|
||||||
|
if (is_null($settings)){
|
||||||
|
$settings = Settings::create();
|
||||||
|
}
|
||||||
return self::where('id', 1)->first();
|
return self::where('id', 1)->first();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue