/** * Edit a post. * * @param int $id * * @return mixed */ public function edit($id = null) { set_meta('title', 'Write a Post'); $content = Content::post()->where('id', $id)->firstOrFail(); $this->authorize('update', $content); return view('orchestra/story::admin.editor', ['content' => $content, 'url' => handles("orchestra::storycms/posts/{$content->getAttribute('id')}"), 'method' => 'PUT']); }
/** * Handle pane for dashboard page. * * @return void */ public function compose() { $pane = $this->widget->make('pane.orchestra'); $posts = Content::post()->publish()->latest(10)->get(); if ($posts->isEmpty()) { return; } $pane->add('story-latest-posts')->attributes(['class' => 'six columns widget'])->title('Latest Post')->content(view('orchestra/story::widgets.latest-posts')->with('posts', $posts)); }
/** * {@inheritdoc} */ protected function getRequestedContent($id, $slug) { if (isset($id) and !is_null($id)) { return Content::post()->publish()->where('id', $id)->firstOrFail(); } elseif (isset($slug) and !is_null($slug)) { return Content::post()->publish()->where('slug', "_post_/{$slug}")->firstOrFail(); } throw new NotFoundHttpException(); }
/** * Show posts. * * @return mixed */ public function posts() { $posts = Content::post()->latestPublish()->paginate(config('orchestra/story::per_page', 10)); return Facile::view('orchestra/story::posts')->with(['posts' => $posts])->render(); }