/** * Finds the Menu model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Menu the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Menu::findOne($id)) !== null) { if (!$model->auth_name) { return $model; } $auth = explode('_', $model->auth_name); $model->mod = $auth[0]; $model->ctrl = $auth[0] . '_' . $auth[1]; return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }