public function actionView($id) { $model = Booking::findOne($id); if ($model !== null) { return $this->render('view', ['model' => $model]); } else { throw new NotFoundHttpException("Not found"); } }
/** * Finds the Tour model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Tour the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Booking::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }