protected function findModelUser($id) { $model = User::findOne($id); if ($model->user_type == 2) { return $userModel = UserDlt::findOne($id); } elseif ($model->user_type == 3) { return $userModel = Usercustoms::findOne($id); } elseif ($model->user_type == 5) { return $userModel = UserTourcompany::findOne($id); } }
/** * Finds the UserDlt model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return UserDlt the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = UserDlt::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }