/** * Deletes an existing Clients model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @return mixed */ public function actionDelete($id) { if ($this->findModel($id)->delete()) { Tasks::deleteAll('client = :client', [':client' => $id]); Contacts::deleteAll('client = :client', [':client' => $id]); } return $this->redirect(['index']); }