Пример #1
0
 public function show($slug)
 {
     $article = Content::article()->active()->published()->where('slug', $slug)->firstOrFail();
     $comments = Comment::where('content_id', $article['id'])->active()->paginate(10);
     $pageTitle = $article['title'];
     return view('frontend.articles.show', compact('article', 'comments', 'pageTitle'));
 }
Пример #2
0
 /**
  * Display the specified resource.
  *
  * @param string $slug
  * @return \Illuminate\Http\Response
  */
 public function show($slug)
 {
     $category = Category::article()->active()->where('slug', '=', $slug)->firstOrFail();
     $articles = Content::article()->active()->where('category_id', '=', $category['id'])->paginate(10);
     return view('frontend.categories.show', compact('category', 'articles'));
 }
Пример #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $article = Content::article()->where('id', '=', $id)->get();
     $this->authorize($article);
     if ($article->delete()) {
         return \Response::json(['status' => true]);
     }
     return \Response::json(['status' => false])->setStatusCode(404);
 }