/** * top page */ public function getIndex() { $sections = $this->section->getSections(); foreach ($sections as $section) { $section->recipes = $this->recipe->getRecipeFromSectionByRand($section->section_id); } $data = ['latest' => $this->recipe->getLatestRecipe(7), 'sections' => $sections, 'popular' => $this->getContentsRanking()]; $this->view('home.index', $data); }