| @@ 99-113 (lines=15) @@ | ||
| 96 | * |
|
| 97 | * @return \yii\web\Response|string redirect or render |
|
| 98 | */ |
|
| 99 | public function actionCreate() |
|
| 100 | { |
|
| 101 | $model = new Flow(); |
|
| 102 | ||
| 103 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|
| 104 | return $this->redirect(['view', 'id' => $model->id]); |
|
| 105 | } else { |
|
| 106 | $flows = ArrayHelper::map(Flow::find()->all(), 'id', 'name'); |
|
| 107 | ||
| 108 | return $this->render('create', [ |
|
| 109 | 'model' => $model, |
|
| 110 | 'flows' => ['' => Yii::t('app', '(none)')] + $flows, |
|
| 111 | ]); |
|
| 112 | } |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * Updates an existing Flow model. |
|
| @@ 123-137 (lines=15) @@ | ||
| 120 | * |
|
| 121 | * @return \yii\web\Response|string redirect or render |
|
| 122 | */ |
|
| 123 | public function actionUpdate($id) |
|
| 124 | { |
|
| 125 | $model = $this->findModel($id); |
|
| 126 | ||
| 127 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|
| 128 | return $this->redirect(['view', 'id' => $model->id]); |
|
| 129 | } else { |
|
| 130 | $flows = ArrayHelper::map(Flow::find()->all(), 'id', 'name'); |
|
| 131 | ||
| 132 | return $this->render('update', [ |
|
| 133 | 'model' => $model, |
|
| 134 | 'flows' => ['' => Yii::t('app', '(none)')] + $flows, |
|
| 135 | ]); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Deletes an existing Flow model. |
|