/**
  * Show posts from category
  *
  * @param Request $request
  * @param null $slug
  * @return \Illuminate\View\View
  */
 public function category(Request $request, $slug = null)
 {
     $category = !$slug ? $this->category->first() : $this->category->findBySlug($slug);
     if (!$category) {
         throw new NotFoundHttpException();
     }
     $posts = $this->post->findByCategory($category, $this->currentUser, 10);
     if ($request->has('ajax')) {
         return $this->jsonPagination($posts, $this->view('ajax.posts', compact('posts')));
     }
     return $this->view('post.list', compact('category', 'posts'));
 }