/** * Edit a page. * * @param int $id * * @return mixed */ public function edit($id = null) { set_meta('title', 'Write a Page'); $content = Content::page()->where('id', $id)->firstOrFail(); $this->authorize('update', $content); return view('orchestra/story::admin.editor', ['content' => $content, 'url' => handles("orchestra::storycms/pages/{$content->getAttribute('id')}"), 'method' => 'PUT']); }
/** * {@inheritdoc} */ protected function getRequestedContent($id, $slug) { if (isset($id) and !is_null($id)) { return Content::page()->publish()->where('id', $id)->firstOrFail(); } elseif (isset($slug) and !is_null($slug)) { return Content::page()->publish()->where('slug', "_page_/{$slug}")->firstOrFail(); } throw new NotFoundHttpException(); }
/** * Show default page. * * @param string $slug * * @return mixed */ protected function page($slug) { $page = Content::page()->publish()->where('slug', '=', $slug)->firstOrFail(); $slug = preg_replace('/^_page_\\//', '', $slug); if (!View::exists($view = "orchestra/story::pages.{$slug}")) { $view = 'orchestra/story::page'; } return Facile::view($view)->with(['page' => $page])->render(); }
/** * Setup the form. * * @param \Illuminate\Support\Fluent $model * @param \Orchestra\Contracts\Html\Form\Builder $form * * @return void */ protected function form(Fluent $model, FormBuilder $form) { $form->extend(function ($form) use($model) { $form->fieldset('Page Management', function ($fieldset) { $pages = Content::page()->publish()->lists('title', 'slug'); if ($pages instanceof Arrayable) { $pages = $pages->toArray(); } $pages = array_merge(['_posts_' => 'Display Posts'], $pages); $fieldset->control('select', 'default_format')->label('Default Format')->options(StoryFormat::getParsers()); $fieldset->control('select', 'default_page')->label('Default Page')->options($pages); $fieldset->control('text', 'Page Permalink', 'page_permalink'); $fieldset->control('text', 'Post Permalink', 'post_permalink'); }); }); }