From 966003adb039d0ff929ef0725e20bbe8b2bcd142 Mon Sep 17 00:00:00 2001 From: glambertessa Date: Wed, 9 Sep 2020 17:52:39 +0300 Subject: [PATCH] custom delete accesses --- .../accesses/controllers/AccessesController.php | 2 ++ backend/modules/accesses/views/accesses/all.php | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/modules/accesses/controllers/AccessesController.php b/backend/modules/accesses/controllers/AccessesController.php index 63769f8..9f8b4a9 100755 --- a/backend/modules/accesses/controllers/AccessesController.php +++ b/backend/modules/accesses/controllers/AccessesController.php @@ -147,6 +147,8 @@ class AccessesController extends Controller UserCardAccesses::deleteAll(['accesses_id' => $clean_id]); Accesses::deleteAll(['id' => $clean_id]); + Yii::$app->session->setFlash('success', "Доступ удален"); + return $this->redirect(['index']); } diff --git a/backend/modules/accesses/views/accesses/all.php b/backend/modules/accesses/views/accesses/all.php index 6d063d8..16d1948 100644 --- a/backend/modules/accesses/views/accesses/all.php +++ b/backend/modules/accesses/views/accesses/all.php @@ -32,7 +32,16 @@ $this->params['breadcrumbs'][] = $this->title; 'link', 'project', 'info', - ['class' => 'yii\grid\ActionColumn'] + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{view} {update} {delete}', + 'buttons' => [ + 'delete' => function ($data) { + return Html::a("", + ['/accesses/accesses/custom-delete', 'id' => $data]); + }, + ], + ], ], ]); ?>