/** * Create a staff member * * @param array $data * @return bool * @throws CreateFailedException */ public function create(array $data) { $account = $this->account->findByName($data['account']); if (!$account) { throw new CreateFailedException('This account does not exist!'); } $player = $this->player->findByName($data['player']); if (!$player) { throw new CreateFailedException('This player does not exist!'); } return (bool) $this->staff->create($data); }
/** * Unblock an account * * @param $id * @return bool */ public function unblockAccount($id) { $wasUnblocked = (bool) $this->account->update(array('id' => $id), array('status' => 'OK', 'availDt' => '0000-00-00 00:00:00')); if ($wasUnblocked) { $this->app['events']->fire('account.unblocked', array(array('account' => $id))); } return $wasUnblocked; }
/** * Generate a new deletion code and sends it to the email * * @param $user * @return bool * @throws DeletionCodeException */ public function deletionCode($user) { $account = $this->account->findById($user); if (!$account) { throw new DeletionCodeException('This account doesn\'t exists'); } $data = ['id' => $account['id'], 'email' => $account['email'], 'login' => $account['login'], 'deletionCode' => str_random(7)]; $this->events->fire('account.deletion_code.before', array($data)); $wasUpdated = $this->account->update(['id' => $user], ['social_id' => $data['deletionCode']]); if ($wasUpdated) { $this->events->fire('account.deletion_code.after', [$data]); $this->meta->set($user, 'deletion_last', Carbon::now()); $this->accountMailer->deletionCode($data)->send(); } return $wasUpdated; }
public function run() { foreach ($this->accounts as $account) { $this->account->create($account); } }
/** * Update the remember token * * @param Authenticatable $user * @param string $token */ public function updateRememberToken(Authenticatable $user, $token) { $this->account->update(['id' => $user->id], [$user->getRememberTokenName() => $token]); }