belongsTo(Activity::class); } public function storeRemotely(?string $html, Client | Vendor $client_or_vendor) { if (empty($html)) { return; } $path = $client_or_vendor->backup_path().'/'; $filename = now()->format('Y_m_d').'_'.md5(time()).'.html'; //@phpstan-ignore-line $file_path = $path.$filename; Storage::disk(config('filesystems.default'))->put($file_path, $html); $this->filename = $file_path; $this->save(); } public function deleteFile() { nlog('deleting => '.$this->filename); if (!$this->filename) { return; } try { Storage::disk(config('filesystems.default'))->delete($this->filename); } catch (\Exception $e) { nlog('BACKUPEXCEPTION deleting backup file with error '.$e->getMessage()); } } }