route('staticpage.overview') ->with('error', trans('staticpages::admin.invalidStatus')); } try { // try to find this page $page = Content::where('module_handler', config('staticpages.handler')) ->findOrFail($id); // page found, save status $page->status = $status; $page->save(); // redirect back to overview with info for user return redirect() ->route('staticpage.overview') ->with('success', trans('staticpages::admin.statusChanged')); } catch (NotFoundHttpException $e) { // page not found return redirect() ->route('staticpage.overview') ->with('error', trans('staticpages::admin.invalidPage')); } } /** * Delete page * * @param $id * * @return \Illuminate\Http\RedirectResponse */ public function deletePage($id) { try { // try to find this page $page = Content::where('module_handler', config('staticpages.handler')) ->findOrFail($id); // page found, save status $page->status = Content::STATUS_DELETED; $page->save(); // redirect back to overview with info for user return redirect() ->route('staticpage.overview') ->with('success', trans('staticpages::admin.pageDeleted', [ 'name' => $page->title, 'url' => $page->url ])); } catch (NotFoundHttpException $e) { // page not found return redirect() ->route('staticpage.overview') ->with('error', trans('staticpages::admin.invalidPage')); } } }