예제 #1
0
 public function actionShowDetail($id)
 {
     $this->layout = "main";
     $model = $this->findModel($id);
     $tourtype = Tourtype::findOne($model->id_tourtype);
     $related = $tourtype->getTours()->orderBy(['regdate' => SORT_DESC])->limit(4)->all();
     return $this->render('show-detail', ['model' => $model, 'related' => $related]);
 }
 /**
  * Finds the Tourtype model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Tourtype the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Tourtype::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }