public function up() { $users = Users::find()->all(); foreach ($users as &$one) { $one->rehash = 0; $one->save(); } }
public static function getAutoReminderRecipients($tournament, $tour) { $candidates = self::find()->joinWith('idUser')->where(['id_tournament' => $tournament, 'notification' => self::NOTIFICATION_ENABLED, 'active' => Users::STATUS_ACTIVE])->all(); $recipients = []; $tours = Games::getNumberOfGamesPerTour($tournament); foreach ($candidates as $one) { if (Forecasts::getUserForecastTour($one['id_user'], $tournament, $tours)[$tour] != '2' && Reminders::ifEligible($tournament, $tour, $one['id_user'])) { $recipients[] = Users::find()->where(['id' => $one['id_user']])->one(); } } return $recipients; }
public function up() { $rbac = \Yii::$app->authManager; $user = $rbac->createRole('user'); $user->description = 'Regular site user'; $rbac->add($user); $admin = $rbac->createRole('administrator'); $admin->description = 'Administrator'; $rbac->add($admin); $rbac->addChild($admin, $user); $users = Users::find()->all(); foreach ($users as $one) { if ($one->id == 1) { $rbac->assign($admin, $one->id); } else { $rbac->assign($user, $one->id); } } }