public function article($slug, Article $article, ArticlesComments $articlesComments) { $article = $article->getBySlug($slug); $comments = $articlesComments->getComments($article->id); $this->data['comments'] = $comments; $this->data['article'] = $article; // dd($this->data); return view('articles.article', $this->data); }
/** * Store a newly created resource in storage. * * @param ArticlesComments $articlesComments * @param Request $request * @param $slug * @param $article_id * @return Response */ public function store(ArticlesComments $articlesComments, Request $request) { $input = $request->all(); $articlesComments->create($input); }
public function urlComment() { $id = (int) $_GET['id']; $comment = ArticlesComments::findOrFail($id); $status = $comment->status == 1 ? 0 : 1; $comment->update(['status' => $status]); return view('articles.comments', ['article' => $comment->article]); }