当前位置: 首页>>代码示例>>PHP>>正文


PHP User::deleteAll方法代码示例

本文整理汇总了PHP中common\models\User::deleteAll方法的典型用法代码示例。如果您正苦于以下问题:PHP User::deleteAll方法的具体用法?PHP User::deleteAll怎么用?PHP User::deleteAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common\models\User的用法示例。


在下文中一共展示了User::deleteAll方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _before

 /**
  * This method is called before each test method.
  *
  * @param \Codeception\Event\TestEvent $event
  */
 public function _before($event)
 {
     // delete this signed up user
     User::deleteAll(['email' => 'demo@example.com', 'username' => 'demo']);
     // delete roles
     Role::deleteAll();
 }
开发者ID:snivs,项目名称:semanti,代码行数:12,代码来源:SignupCest.php

示例2: actionDelete

 public function actionDelete($id)
 {
     if (empty($user = User::findOne($id))) {
         throw new \yii\web\NotFoundHttpException();
     }
     $count = User::deleteAll(['id' => $id]);
     Invitation::deleteAll(['email' => $user->email, 'status' => Invitation::STATUS_SIGNUP]);
     if ($count >= 1) {
         $this->goBack();
     }
 }
开发者ID:bolom009,项目名称:testwork_vdo,代码行数:11,代码来源:SiteController.php

示例3: actionDelete

 public function actionDelete($id = 'none', $ids = 'none')
 {
     if ($id != 'none') {
         if (User::find()->where(['id' => $id])->one()->delete()) {
             Yii::$app->getSession()->addFlash('success', '<b>Пользователь успешно удален</b>');
             return $this->actionIndex();
         } else {
             Yii::$app->getSession()->addFlash('success', '<b>Не удалось удалить пользователя</b>');
             return $this->actionIndex();
         }
     }
     if ($ids != 'none') {
         $ids = explode(',', $ids);
         if (User::deleteAll(['id' => $ids])) {
             Yii::$app->getSession()->addFlash('success', '<b>Пользователи успешно удалены</b>');
             return $this->actionIndex();
         } else {
             Yii::$app->getSession()->addFlash('success', '<b>Не удалось удалить пользователя</b>');
             return $this->actionIndex();
         }
     }
 }
开发者ID:askeroff,项目名称:blogyii2,代码行数:22,代码来源:UsersController.php

示例4: actionUser

 public function actionUser()
 {
     // create or change global admin user
     User::deleteAll(['username' => 'admin']);
     echo "\n Введите новый пароль администратора или пустую строку для выхода ";
     $passw = trim(fgets(STDIN));
     if (!$passw) {
         echo "\n Действие прервано \n ";
         exit(1);
     }
     $model = new User();
     $model->username = 'admin';
     $model->email = Yii::$app->params['adminEmail'];
     $model->password = $passw;
     $model->role = User::ROLE_ADMIN;
     if ($model->save(false)) {
         echo "\n Пароль администратора изменен \n ";
         exit(0);
     } else {
         echo "\n Ошибка изменения пароля \n ";
         exit(1);
     }
 }
开发者ID:vastander,项目名称:yii2-eer,代码行数:23,代码来源:AdminController.php

示例5: actionDeleteUser

 public function actionDeleteUser()
 {
     $selection = (array) Yii::$app->request->post('selection');
     foreach ($selection as $id) {
         if ($id != Yii::$app->params['adminId']) {
             User::deleteAll(['id' => $id]);
             Post::deleteAll(['user_id' => $id]);
             PostNotification::deleteAll(['action_id' => $id]);
             PostNotification::deleteAll(['receiver_id' => $id]);
             Comment::deleteAll(['user_id' => $id]);
             Like::deleteAll(['user_id' => $id]);
             Message::deleteAll(['sender_id' => $id]);
             Message::deleteAll(['receiver_id' => $id]);
             Relationship::deleteAll(['user_id_1' => $id]);
             Relationship::deleteAll(['user_id_2' => $id]);
             RelationshipNotification::deleteAll(['action_id' => $id]);
             RelationshipNotification::deleteAll(['receive_id' => $id]);
             Schedule::deleteAll(['own_id' => $id]);
             ScheduleNotification::deleteAll(['action_id' => $id]);
             ScheduleNotification::deleteAll(['receiver_id' => $id]);
         }
     }
     return $this->render('user-manage');
 }
开发者ID:ockor,项目名称:yii2adv-blog,代码行数:24,代码来源:AdminController.php

示例6: _after

 /**
  * This method is called after each cest class test method, even if test failed.
  * @param \Codeception\Event\TestEvent $event
  */
 public function _after($event)
 {
     User::deleteAll(['email' => 'tester.email@example.com', 'username' => 'tester']);
 }
开发者ID:no7kpo,项目名称:9bbb2f9c7a036dfa5b0aa6f5483e7bef,代码行数:8,代码来源:SignupCest.php

示例7: testSignup

 /**
  * @param AcceptanceTester $I
  */
 public function testSignup(AcceptanceTester $I)
 {
     Option::up('allow_signup', '1');
     $I->wantTo('ensure that signup works');
     $signupPage = SignupPage::openBy($I);
     $I->see('Register a new membership', 'p');
     $I->amGoingTo('submit signup form with no data');
     $signupPage->submit([]);
     $I->expectTo('see validations error');
     $I->see('Username cannot be blank.', '.help-block');
     $I->see('Email cannot be blank.', '.help-block');
     $I->see('Password cannot be blank.', '.help-block');
     $I->amGoingTo('submit signup form with no correct email and password');
     $signupPage->submit(['username' => 'newuser', 'email' => 'newuser.email', 'password' => 'pass']);
     $I->expectTo('see that email and password are not correct.');
     $I->dontSee('Username cannot be blank.', '.help-block');
     $I->see('Email is not a valid email address.', '.help-block');
     $I->see('Password should contain at least 6 characters.', '.help-block');
     $I->amGoingTo('submit signup form with correct data');
     $signupPage->submit(['username' => 'newuser', 'email' => 'newuser@writesdown.dev', 'password' => 'password']);
     $I->expect('new user saved.');
     $I->dontSee('Username cannot be blank.', '.help-block');
     $I->dontSee('Email is not a valid email address.', '.help-block');
     $I->dontSee('Password should contain at least 6 characters.', '.help-block');
     User::deleteAll(['username' => 'newuser']);
     Option::up('allow_signup', '0');
 }
开发者ID:hdushku,项目名称:app-cms,代码行数:30,代码来源:SiteCest.php

示例8: testCreate

 /**
  * @param AcceptanceTester $I
  */
 public function testCreate(AcceptanceTester $I)
 {
     $I->wantTo('ensure that create user works');
     $createPage = CreatePage::openBy($I);
     $I->see('Add New User', 'h1');
     $I->cantSeeElement('#user-role option[value="superadmin"]');
     $I->amGoingTo('submit user form with no data');
     $createPage->submit([]);
     $I->expectTo('see validation errors');
     $I->see('Username cannot be blank.', '.help-block');
     $I->see('Email cannot be blank.', '.help-block');
     $I->see('Password cannot be blank.', '.help-block');
     $I->amGoingTo('submit user form with no correct email and password');
     $createPage->submit(['username' => 'newuser', 'password' => 'newu', 'email' => 'newuser@email']);
     $I->expectTo('see that given email is not correct');
     $I->dontSee('Username cannot be blank.', '.help-block');
     $I->see('Password should contain at least 6 characters.', '.help-block');
     $I->see('Email is not a valid email address.', '.help-block');
     $I->amGoingTo('submit user form with correct data');
     $createPage->submit(['username' => 'newuser', 'password' => 'newuser', 'email' => 'newuser@writesdown.dev']);
     $I->expect('new user saved');
     $I->see('View User: newuser', 'h1');
     User::deleteAll(['username' => 'newuser']);
 }
开发者ID:ochiem,项目名称:app-cms,代码行数:27,代码来源:UserCest.php

示例9: actionDeleteajx

 public function actionDeleteajx()
 {
     $post = Yii::$app->request->post();
     $post['id'];
     User::deleteAll(['id' => $post['id']]);
 }
开发者ID:avkosme,项目名称:test,代码行数:6,代码来源:UserController.php

示例10: actionDeleteemployee

 public function actionDeleteemployee()
 {
     $data = json_decode(file_get_contents("php://input"));
     $query = User::deleteAll('sn=' . $data->sn);
     if ($query) {
         $response["status"] = 'success';
         $response["message"] = 'Owner deleted successfully.';
         //$response["data"]=(int)$model->id;
         http_response_code(200);
         header('Content-type: application/json');
         echo json_encode($response, JSON_NUMERIC_CHECK);
     }
 }
开发者ID:nahidlu,项目名称:easysale,代码行数:13,代码来源:EmployeeController.php


注:本文中的common\models\User::deleteAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。