Answer: How to toggle value in database on click of a button (YII2)
Gabriel Alejandro López López

Gabriel Alejandro López López @glpzzz

About: I’m a software engineer living in Cienfuegos, Cuba. I am a fan of programming, web development, and entrepreneurship. I’m also interested in technology and music.

Location:
Cienfuegos, Cuba
Joined:
Aug 25, 2019

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

Publish Date: Sep 25 '20
2 0

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

Comments 0 total

    Add comment