public function actionDelete($id) { if ($this->findModel(Carousel::className(), $id)->delete() !== false) { $this->setFlash('success', \Yii::t('app', 'Modifications have been saved')); } else { $this->setFlash('error', \Yii::t('app', 'Modifications have not been saved')); } return $this->redirect(['/carousel/index']); }
<?php /** * $model Carousel model */ $form = \yii\bootstrap\ActiveForm::begin(['enableClientValidation' => true, 'options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'image_tmp')->fileInput(['class' => 'btn btn-primary'])->label(Yii::t('app', 'Image')); echo $form->field($model, 'link'); echo $form->field($model, 'status')->dropDownList(\app\models\Carousel::statuses()); echo \yii\helpers\Html::a(\Yii::t('app', 'List'), ['index'], ['class' => 'btn btn-info']); ?> <?php echo \yii\helpers\Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-primary']); ?> <?php $form->end();