public function testCommentResult() { $result = $this->service->getCommentsByEntry(1); $this->assertSame(20, $result->count()); $result = $this->service->getCommentsByEntry(10); $this->assertSame(0, $result->count()); }
/** * @param $id * * @return \Illuminate\View\View */ public function show($id) { $attributes = ['entry' => $this->entry->getEntry($id), 'comments' => $this->comment->getCommentsByEntry($id)]; return view('entry.show', $attributes); }
/** * @param CommentRequest $request * @param CommentService $comment * * @return \Illuminate\Http\RedirectResponse */ public function store(CommentRequest $request, CommentService $comment) { $params = $request->only(['name', 'comment', 'entry_id']); $comment->addComment($params); return redirect()->route('entry.show', [$params['entry_id']]); }