/**
  * Edit the post
  *
  * @param $id
  * @return mixed
  * @throws \Exception
  */
 public function editForm($id)
 {
     $post = $this->post->getPostById($id);
     if (!$post) {
         return redirect()->route('admin.posts.list');
     }
     $categories = $this->category->all();
     $categories = $this->post->prepareCategories($post, $categories);
     return $this->view('posts.edit', compact('post', 'categories'));
 }
 /**
  * Delete category
  *
  * @param $id
  * @return mixed
  */
 public function doDelete($id)
 {
     $this->category->delete($id);
     return redirect()->back();
 }
 /**
  * Display the category with its posts by slug
  *
  * @param $slug
  * @return mixed
  */
 public function serve($slug)
 {
     $data = $this->categoryService->search($slug);
     return $this->view('category', compact('data'));
 }