Hi, I am new to Yii Framework. Currently I am dong the project by using the Yii 2.0. I am facing the problem for delete the data. Actually I am following the online tutorial. The error show "Calling unknown method: yii\db\ActiveQuery::delete()" when i am trying to delete the date.
Below is my code, please let me know where is the mistake. Thank you.
public function actionDelete($id=null){
if($id===null)
{
Yii::$app->session->setFlash('error','no data');
Yii::$app->getResponse()->redirect(array('site/userlist'));
}
$deluser= User::find($id);
if ($deluser===NULL)
{
Yii::$app->session->setFlash('error','no id data');
Yii::$app->getResponse()->redirect(array('site/userlist'));
}
$deluser ->delete();
Yii::$app->session->setFlash('success','id deleted');
Yii::$app->getResponse()->redirect(array('site/userlist'));
}