'app\models\Anime', 'Manga' => 'app\models\Manga', 'Kdrama' => 'app\models\Kdrama', 'anime' => 'app\models\Anime', 'manga' => 'app\models\Manga', 'kdrama' => 'app\models\Kdrama'); public function index($type, $by = 'title') { $searchParam = '/' . $this->request->query['search'] . '/i'; $page = $this->request->query['page'] ?: 1; //If the type part of the URL is a valid type (as defined above), if (isset($this->_types[$type])) { $model = $this->_types[$type]; //Forcing search to title for now, until the search frontend is done return $model::search($searchParam, $page, 'title'); } } }