/** * Updates the page record in the database * PUT /pages/{id} * @param $id * @param Request $request */ public function update($id, Request $request) { // find if theme and page exists $page = $this->pages->findOrFail($id); $theme = $this->themes->findOrFail($request->get('theme_id')); $page->updateContent($request->get('content')); $page->updateTheme($theme->id); $page->updateKey($request->get('key')); $page->updateTitle($request->get('title')); return Response::json(['error' => false]); }
/** * Returns the view to be rendered * for the theme preview * @param $id * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function getPreview($id) { $theme = $this->themes->findOrFail($id); preg_match('/(.+)\\.blade\\.php/', $theme->filename, $name); return view("parshtemplates::{$name[1]}"); }