namespace app\controllers;
+use yii\db\StaleObjectException;
use yii_app\records\AdminGroup;
use yii_app\records\StoreGuidBuh;
use kartik\select2\Select2;
'model' => $model
]);
}
+
+ /**
+ * @throws \Throwable
+ * @throws StaleObjectException
+ */
+ public function actionDeleteStoreGuidBuh($id)
+ {
+ try {
+ if ($model = StoreGuidBuh::findOne($id)) {
+ $model->delete();
+ }
+ }catch (\Exception $e) {
+ throw new \Exception($e);
+ }
+
+ $this->redirect(Yii::$app->request->referrer);
+ }
}
\ No newline at end of file
<?php
use kartik\form\ActiveForm;
+use yii\grid\ActionColumn;
use yii\grid\GridView;
use yii\helpers\Html;
+use yii\helpers\Url;
use yii_app\records\CityStore;
/** @var yii\web\View $this */
return date('d-m-Y H:i:s', strtotime($model->updated_at));
}
],
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{delete}',
+ 'buttons' => [
+ 'delete' => function ($url, $model, $key) {
+ return Html::a(
+ '<span class="glyphicon glyphicon-trash"></span>',
+ Url::to(['delete-store-guid-buh', 'id' => $model->id]),
+ [
+ 'title' => 'Удалить',
+ 'data' => [
+ 'confirm' => 'Вы уверены, что хотите удалить этот элемент?',
+ 'method' => 'post',
+ ],
+ ]
+ );
+ },
+ ],
+ ],
],
]); ?>