1]); } public function upsert(array $data): CompanySetting { $setting = CompanySetting::firstOrNew(['id' => 1]); $setting->fill($data); $setting->save(); return $setting->fresh(); } public function uploadHeroBackground(UploadedFile $file): CompanySetting { $setting = $this->get(); if ($setting->hero_background_path) { Storage::disk('s3')->delete($setting->hero_background_path); } $path = $file->store('company/hero', 's3'); $setting->hero_background_path = $path; $setting->save(); return $setting->fresh(); } public function removeHeroBackground(): CompanySetting { $setting = $this->get(); if ($setting->hero_background_path) { Storage::disk('s3')->delete($setting->hero_background_path); $setting->hero_background_path = null; $setting->save(); } return $setting->fresh(); } }