/**
  * @param $id
  * @return \Illuminate\Http\JsonResponse
  */
 public function show($id)
 {
     $input = \Input::get('format', 'json');
     $array = [];
     $recipe = $this->recipe->getRecipe($id);
     if ($recipe) {
         $category = $this->category->getCategory($recipe->category_id);
         $array = ['id' => $recipe->recipe_id, 'title' => $recipe->title, 'problem' => $recipe->problem, 'category' => ['description' => $category->description, 'name' => $category->name]];
     }
     // render for hypermedia
     if ($input == 'hal') {
         $this->hal->setUri(route('home.recipe', ['one' => $id]));
         $this->hal->setData($array);
         $array = $this->hal;
     }
     return $this->render($array, $input);
 }
 /**
  * @access private
  * @return mixed
  */
 private function getContentsRanking()
 {
     $result = $this->analytics->getSortedCount(0, 6);
     if ($result) {
         foreach ($result as $row) {
             $recipe = $this->recipe->getRecipe($row->recipe_id);
             $category = $this->category->getCategory($recipe->category_id);
             $row->category_id = isset($recipe->category_id) ? $recipe->category_id : null;
             $row->title = isset($recipe->title) ? $recipe->title : null;
             $row->name = isset($category->name) ? $category->name : null;
         }
     }
     return $result;
 }