/** * نمایش لیست کامنتها * * @param Illuminate\Http\Request $request * @return Response */ public function comments(Request $request) { $nbrPosts = $this->PostRepository->getNumber(); $nbrComments = $this->CommentRepository->getNumber(); $nbrTags = $this->PostRepository->getTags(); $tag = $request->tag; $page = 1; if (isset($request->page)) { $page = $request->page; } if ($tag == "all") { $tag = NULL; } $comments = $this->CommentRepository->lists(10, $tag, $request->name, $request->sens, $request->approved); $links = $comments->appends(['name' => $request->name, 'sens' => $request->sens, 'tag' => $request->tag, 'approved' => $request->approved]); if ($request->approved == 2) { $this->CommentRepository->updateBatchSeen(1, $comments->lists('cmt_id')); } if ($request->ajax()) { return response()->json(['view' => view('admin.Comment.AjaxCommentsList', compact('comments'))->render(), 'links' => $links->setPath('order')->render()]); } $links->setPath('')->render(); $order = (object) ['name' => $request->name, 'sens' => 'sort-' . $request->sens, 'tag' => $request->tag, 'approved' => $request->approved]; return view('admin.Comment.Comments', compact('nbrPosts', 'nbrComments', 'nbrTags', 'comments', 'links', 'order', 'page')); }