accesses custom delete & validation
This commit is contained in:
parent
c5227f1ee4
commit
75ccbff934
@ -114,7 +114,11 @@ class AccessesController extends Controller
|
|||||||
|
|
||||||
public function actionCustomDelete($id)
|
public function actionCustomDelete($id)
|
||||||
{
|
{
|
||||||
|
$clean_id = str_replace('=', "", stristr($id, '='));
|
||||||
|
UserCardAccesses::deleteAll(['accesses_id' => $clean_id]);
|
||||||
|
Accesses::deleteAll(['id' => $clean_id]);
|
||||||
|
|
||||||
|
return $this->redirect(['index']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,17 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
// return $model->getProjectName();
|
// return $model->getProjectName();
|
||||||
// },
|
// },
|
||||||
// ],
|
// ],
|
||||||
['class' => 'yii\grid\ActionColumn'],
|
[
|
||||||
|
'class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view} {update} {delete}',
|
||||||
|
'buttons' => [
|
||||||
|
'delete' => function ($data) {
|
||||||
|
return Html::a("<span class='glyphicon glyphicon-trash' aria-hidden='true'></span>",
|
||||||
|
['/accesses/accesses/custom-delete', 'id' => $data]);
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
// ['class' => 'yii\grid\ActionColumn'],
|
||||||
],
|
],
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,6 +40,7 @@ class Accesses extends \yii\db\ActiveRecord
|
|||||||
[['info'], 'string'],
|
[['info'], 'string'],
|
||||||
[['_projects'], 'safe'],
|
[['_projects'], 'safe'],
|
||||||
[['_users'], 'safe'],
|
[['_users'], 'safe'],
|
||||||
|
[['name', 'login', 'password', 'link', 'project', 'info'], 'required'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user