コード例 #1
0
ファイル: StaffService.php プロジェクト: maxupunk/metin2cms
 /**
  * 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);
 }
コード例 #2
0
ファイル: AdminService.php プロジェクト: maxupunk/metin2cms
 /**
  * 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;
 }
コード例 #3
0
ファイル: AccountService.php プロジェクト: maxupunk/metin2cms
 /**
  * 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;
 }
コード例 #4
0
 public function run()
 {
     foreach ($this->accounts as $account) {
         $this->account->create($account);
     }
 }
コード例 #5
0
 /**
  * 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]);
 }