public function actionDelete($id)
    {
        // delete profile and userTokens first to handle foreign key constraint
        $user = $this->findModel($id);
        $profile = $user->profile;
        $userToken = $this->module->model("UserToken");
        $userAuth = $this->module->model("UserAuth");
        $userToken::deleteAll(['user_id' => $user->id]);
        $userAuth::deleteAll(['user_id' => $user->id]);
        $profile->delete();
        $user->delete();

        return $this->redirect(['index']);
    }
public function actionDelete($id)
    {
        // delete profile and userTokens first to handle foreign key constraint
        $user = $this->findModel($id);
        $profile = $user->profile;
        $userToken = $this->module->model("UserToken");
        $userAuth = $this->module->model("UserAuth");
        $userToken::deleteAll(['user_id' => $user->id]);
        $userAuth::deleteAll(['user_id' => $user->id]);
        $profile->delete();
        $user->delete();

        return $this->redirect(['index']);
    }
public function actionDelete ( $ id ) { // delete profile and userTokens first to handle foreign key constraint $ user = $ this -> findModel ( $ id ) ; $ profile = $ user -> profile ; $ userToken = $ this -> module -> model ( "UserToken" ) ; $ userAuth = $ this -> module -> model ( "UserAuth" ) ; $ userToken :: deleteAll ( [ 'user_id' => $ user -> id ] ) ; $ userAuth :: deleteAll ( [ 'user_id' => $ user -> id ] ) ; $ profile -> delete ( ) ; $ user -> delete ( ) ; return $ this -> redirect ( [ 'index' ] ) ; }
Delete an existing User model. If deletion is successful, the browser
will be redirected to the 'index' page.
@param string $id
@return mixed
Delete an existing User model . If deletion is successful the browser will be redirected to the index page .