protected function findModels($code) { if (($models = RiskBooking::findOne($code)) !== null) { return $models; } else { throw new NotFoundHttpException('The requested page does not exist. #2'); } }
/** * Finds the RiskBooking model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $Branch * @param string $Code * @param string $Corp * @return RiskBooking the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($Branch, $Code, $Corp) { if (($model = RiskBooking::findOne(['Branch' => $Branch, 'Code' => $Code, 'Corp' => $Corp])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }