public function is_rel($id) { $r = RRelated::findOne(['id_category' => $this->id, 'id_related_category' => $id]); if ($r) { return true; } else { return false; } }
public function actionDeleteRelatedCategory() { $get = Yii::$app->request->get(); $id = $get["id"]; $id_rel_category = $get["id_rel_category"]; $RRelated = RRelated::findOne(["id_category" => $id, "id_related_category" => $id_rel_category]); if ($RRelated) { $RRelated->delete(); } }