settings = $settingsService; $this->render = $renderService; $this->maintenance = $maintenanceService; $this->member = $memberRepo; $this->assets = $assetService; } public function publish(Request $request) { $this->assets->moveToTheme(true); $result = $this->render->publishAll(); return response()->json($result)->header('Content-Type', 'application/json'); } public function sync(Request $request) { $body = json_decode($request->getContent()); //update member if needed $this->member->update($body->member); //sync settings $result = $this->settings->sync($body); return response()->json($result)->header('Content-Type', 'application/json'); } public function navSync(Request $request) { $body = json_decode($request->getContent()); $result = $this->settings->navSync($body); return response()->json($result)->header('Content-Type', 'application/json'); } public function createBackup(Request $request) { $body = json_decode($request->getContent()); if ($body->task == 'content_backup') { return response()->json( $this->maintenance->createContentBackUp() )->header('Content-Type', 'application/json'); } else { return response()->json( $this->maintenance->createFileBackUp() )->header('Content-Type', 'application/json'); } } public function downloadBackup(Request $request) { if ($this->member::status()) { $latest = ''; $file = ''; if (explode('/', $request->getRequestUri())[4] == 'content-download') { $latest = $this->settings->getGlobal()['last_content_backup']; $file = 'backup-content-' . $latest . '.zip'; } else { $latest = $this->settings->getGlobal()['last_files_backup']; $file = 'backup-files-' . $latest . '.zip'; } return response()->download( '../content/backups/' . $file, $file, ['Content-Type: application/zip'] ); } } }