history = $history; $this->file = $file; $this->content = $content; $this->module = $module; $this->category = $category; $this->template = $template; } /** * Display form for editing static page * * @param Content $page * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function edit(Content $page) { $statuses = ContentStatuses::getWithTranslations(); // get module ID $module = $this->module->getByHandler($page->moduleHandler); $pageHeading = $this->module->getUpdateContentTitle($module, $page); $templates = $this->template->getForModule($module); $categories = $this->category->getForModule($module); $history = $this->history->getStructuredHistoryOf($page); // render view return view('admin.content.edit', [ 'pageHeading' => $pageHeading, 'contentStatuses' => $statuses, 'page' => $page, 'module' => $module, 'categories' => $categories, 'rootPages' => $this->content->getOverview()->get(), 'templates' => $templates, 'formSectionNames' => $this->module->call($module, 'getExtendedFormSections'), 'formSections' => $this->module->call($module, 'getExtendedFormInputsEdit'), 'historySize' => count($history['changesets']) ]); } /** * Edit static page and save changes into history. * * @param EditContentRequest|Request $request * @param Content $page * * @return \Illuminate\Http\RedirectResponse * @internal param $id */ public function update(Request $request, Content $page) { // edit page Interaction::handle(EditContentInteraction::class, $request->all(), $page); // something was changed, inform user return redirect() ->route('content.overview') ->with('success', trans('admin/contents.successfullyEdited')); } }