refactor: remove global RateCardProfile singleton usage from controllers and delete unused welcome view
This commit is contained in:
@@ -26,16 +26,30 @@ class RateCardProfile extends Model
|
||||
'content_showcase' => 'array',
|
||||
];
|
||||
|
||||
protected static ?self $instance = null;
|
||||
|
||||
/** Get the singleton profile, creating defaults if needed */
|
||||
public static function getSingleton(): self
|
||||
{
|
||||
return static::firstOrCreate([], [
|
||||
if (self::$instance) {
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
self::$instance = static::firstOrCreate([], [
|
||||
'owner_name' => config('app.name', 'Cathy Page'),
|
||||
'bg_color' => '#FFF8F0',
|
||||
'accent_color' => '#FFB7C5',
|
||||
'text_color' => '#374151',
|
||||
'show_prices' => true,
|
||||
]);
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::saved(fn ($model) => self::$instance = $model);
|
||||
static::deleted(fn () => self::$instance = null);
|
||||
}
|
||||
|
||||
public function getWhatsappUrlAttribute(): ?string
|
||||
|
||||
Reference in New Issue
Block a user