@@ 104-116 (lines=13) @@ | ||
101 | } |
|
102 | ||
103 | return $this->redirect(['view', 'id' => $model->id]); |
|
104 | } else { |
|
105 | $templates = ScreenTemplate::find()->all(); |
|
106 | $templatesArray = array_reduce($templates, function ($a, $t) { |
|
107 | $a[$t->id] = $t->name; |
|
108 | ||
109 | return $a; |
|
110 | }, []); |
|
111 | ||
112 | return $this->render('create', [ |
|
113 | 'model' => $model, |
|
114 | 'templates' => $templatesArray, |
|
115 | ]); |
|
116 | } |
|
117 | } |
|
118 | ||
119 | /** |
|
@@ 133-145 (lines=13) @@ | ||
130 | ||
131 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|
132 | return $this->redirect(['view', 'id' => $model->id]); |
|
133 | } else { |
|
134 | $templates = ScreenTemplate::find()->all(); |
|
135 | $templatesArray = array_reduce($templates, function ($a, $t) { |
|
136 | $a[$t->id] = $t->name; |
|
137 | ||
138 | return $a; |
|
139 | }, []); |
|
140 | ||
141 | return $this->render('update', [ |
|
142 | 'model' => $model, |
|
143 | 'templates' => $templatesArray, |
|
144 | ]); |
|
145 | } |
|
146 | } |
|
147 | ||
148 | /** |