controllers/AppController.php
/**
     * Deletes an existing Users model.
     * If deletion is successful, the browser will be redirected to the 'index' page.
     * @param integer $id
     * @return mixed
     * @throws NotFoundHttpException if the model cannot be found
     */
Deletes an existing Users model.
If deletion is successful, the browser will be redirected to the 'index' page.
@param integer $id
@return mixed
@throws NotFoundHttpException if the model cannot be found
Deletes an existing Users model . If deletion is successful the browser will be redirected to the ' index ' page . @param integer $id @return mixed @throws NotFoundHttpException if the model cannot be found
public function actionDelete($id)
    {
        $connection = Yii::$app->db;
        $transaction = $connection->beginTransaction();
        try {
            $connection->createCommand()
            ->delete('users_pacientes', ['users_id' => $id])
            ->execute();
            $connection->createCommand()
            ->delete('users', ['id' => $id])
            ->execute();
            $transaction->commit();
        } catch (\Exception $e) {
            $transaction->rollBack();
            throw $e;
        } catch (\Throwable $e) {
            $transaction->rollBack();
            throw $e;
        }
        return $this->redirect(['show']);
    }
public function actionDelete ( $ id ) { $ connection = Yii :: $ app -> db ; $ transaction = $ connection -> beginTransaction ( ) ; try { $ connection -> createCommand ( ) -> delete ( 'users_pacientes' , [ 'users_id' => $ id ] ) -> execute ( ) ; $ connection -> createCommand ( ) -> delete ( 'users' , [ 'id' => $ id ] ) -> execute ( ) ; $ transaction -> commit ( ) ; } catch ( \ Exception $ e ) { $ transaction -> rollBack ( ) ; throw $ e ; } catch ( \ Throwable $ e ) { $ transaction -> rollBack ( ) ; throw $ e ; } return $ this -> redirect ( [ 'show' ] ) ; }
Deletes an existing Users model.
Deletes an existing Users model .