DEV Community

Gabriel Alejandro López López
Gabriel Alejandro López López

Posted on • Updated on

Answer: How to toggle value in database on click of a button (YII2)

This is just a soft delete then: no actual row is deleted but "marked". Two parts for this code:

Controller


public function behaviors()
{
    return [
        //
        'verbs' => [
            'class' => \yii\filters\VerbFilter::className(),
            'actions' => [
                'delete' => ['POST'],
            ],
        ],
        // ....
    ];
}


public function actionDelete($id){
    $model

Top comments (0)