예제 #1
0
 /**
  * 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'));
 }
예제 #2
0
 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'));
 }
예제 #3
0
 /**
  * @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');
 }
예제 #4
0
 /**
  * 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());
 }
예제 #5
0
 /**
  * @param int $id
  */
 public function destroy($id)
 {
     $field = Author::findOrFail($id);
     $field->delete();
 }