/** * Display the specified resource. * * @param string $author_slug * @return \Illuminate\Http\Response */ public function show($author_slug) { $author = Author::getBySlug($author_slug); $posts = Post::whereHas('author', function ($query) use($author_slug) { $query->where('slug', $author_slug)->where('show_author', true); })->simplePaginate(); return view('flashtag::authors.show', compact('author', 'posts')); }
public function edit($id) { $post = Post::with('author', 'fields', 'category', 'tags')->findOrFail($id); $post->lock(auth()->user()->id); $categories = Category::all(['id', 'name']); $tags = Tag::all(['id', 'name']); $authors = Author::all(['id', 'name']); $fields = Field::all(); return view('admin::posts.edit', compact('post', 'categories', 'tags', 'authors', 'fields')); }
/** * @param AuthorDestroyRequest $request * @param int $id * @return \Illuminate\Http\RedirectResponse */ public function destroy(AuthorDestroyRequest $request, $id) { $author = Author::findOrFail($id); $author->delete(); return redirect()->route('admin::authors.index'); }
/** * Remove the specified author from storage. * * @param int $id * @return \Dingo\Api\Http\Response */ public function destroy($id) { $author = $this->author->findOrFail($id); $author->delete(); return $this->response->item($author, new AuthorTransformer()); }
/** * @param int $id */ public function destroy($id) { $field = Author::findOrFail($id); $field->delete(); }