I have two tables table1 and table2 and I am trying to delete row in these two table.I have same values on both table but id is different so i tried like this, my controller,
public function actionDelete($id)
{
$this->findModel($id);
$select = Employee::find()
->select('Name')
->where(['Id' => $id])
->all();
$deluser=Employee::find()->where(['Id' => $id])->one()->delete() AND User::find()->where(['Name' =>$select])->one();
$deluser->delete();
return $this->redirect(['index','select'=>$select]);
}
pls anyone help me Thanks in advance