request->query['q'])) { $q = '/' . $this->request->query['q'] . '/i'; $conditions = array('title' => array('like' => $q)); $limit = 10; $anime = Anime::find('all', compact('conditions', 'limit')); $manga = Manga::find('all', compact('conditions', 'limit')); $kdrama = Kdrama::find('all', compact('conditions', 'limit')); return compact('anime', 'manga', 'kdrama'); } } public function anime($by = 'title') { $q = isset($this->request->query['q']) ? '/' . $this->request->query['q'] . '/i' : ''; $page = isset($this->request->query['page']) ? $this->request->query['page'] : 1; return Anime::search($q, $page, 'title'); } }