public function actionUncheckService($id) { if (Yii::$app->request->isAjax) { $checklist = Checklist::find()->where(['user_id' => Yii::$app->user->id, 'service_id' => $id])->one(); if ($checklist->delete()) { $uncheck = true; } else { $uncheck = false; } die(Json::encode(['uncheck' => $uncheck])); } }
public function init() { $this->checklist = Checklist::find()->where(['user_id' => Yii::$app->user->id])->all(); $this->checklist_grouped = Checklist::find()->where(['user_id' => Yii::$app->user->id])->groupBy(['category_id'])->all(); }