/**
  * Creates a new Trmaschedule model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($id = 1)
 {
     $model = new Trmaschedule();
     $querytest = Trmaschedule::find()->where(['MedicaladvID' => $id])->orderBy('mascheduleID')->all();
     $matitle = Msmedicaladv::findOne($id);
     $medicaladvs = Msmedicaladv::find()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->mascheduleID]);
     } else {
         return $this->render('create', ['model' => $model, 'querytest' => $querytest, 'matitle' => $matitle, 'medicaladvs' => $medicaladvs]);
     }
 }
 /**
  * Finds the Msmedicaladv model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Msmedicaladv the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Msmedicaladv::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }