/** * Creates a new MeetingTime model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate($meeting_id) { $mtg = new Meeting(); $title = $mtg->getMeetingTitle($meeting_id); $model = new MeetingTime(); $model->meeting_id = $meeting_id; $model->suggested_by = Yii::$app->user->getId(); $model->status = self::STATUS_PROPOSED; if ($model->load(Yii::$app->request->post())) { // convert date time to timestamp $model->start = strtotime($model->start); // validate the form against model rules if ($model->validate()) { // all inputs are valid $model->save(); return $this->redirect(['/meeting/view', 'id' => $model->meeting_id]); } else { // validation failed return $this->render('create', ['model' => $model, 'title' => $title]); } } else { return $this->render('create', ['model' => $model, 'title' => $title]); } }