title(__('navigation.backup.failed')) ->danger() ->send(); return; } $backupDir = storage_path('app/backups'); if (! is_dir($backupDir)) { mkdir($backupDir, 0755, true); } foreach (glob($backupDir . '/matab-backup-*.sqlite') as $oldFile) { unlink($oldFile); } $filename = 'matab-backup-' . now()->format('Y-m-d_H-i-s') . '.sqlite'; copy($dbPath, $backupDir . '/' . $filename); Notification::make() ->title(__('navigation.backup.success')) ->success() ->send(); } public function runSync(): void { $service = SyncService::fromConfig(); if (! $service->isConfigured()) { $this->syncFailed = true; $this->reportLines = [__('navigation.sync.error_not_configured')]; $this->dispatch('sync-finished', success: false); return; } $result = $service->sync(); $this->reportLines = $result['report'] ?? []; if ($result['success']) { $this->syncSuccess = true; $this->dispatch('sync-finished', success: true); } else { $this->syncFailed = true; $this->dispatch('sync-finished', success: false); } } public function render() { return view('livewire.settings-dropdown'); } }