Example #1
0
 /**
  * Run the Update
  *
  * @return mixed|void
  */
 public function call()
 {
     $result = $this->setScope('account')->getPheal()->AccountStatus();
     $account_status = AccountStatusModel::firstOrNew(['keyID' => $this->api_info->key_id]);
     $account_status->fill(['paidUntil' => $result->paidUntil, 'createDate' => $result->createDate, 'logonCount' => $result->logonCount, 'logonMinutes' => $result->logonMinutes]);
     $account_status->save();
     return;
 }
Example #2
0
 /**
  * Return the Account Status information for a specific
  * character
  *
  * @param $character_id
  */
 public function getCharacterAccountInfo($character_id)
 {
     $key_info = ApiKeyInfoCharacters::where('characterID', $character_id)->leftJoin('account_api_key_infos', 'account_api_key_infos.keyID', '=', 'account_api_key_info_characters.keyID')->where('account_api_key_infos.type', '!=', 'Corporation')->first();
     if ($key_info) {
         return AccountStatus::find($key_info->keyID);
     }
     return;
 }
Example #3
0
 /**
  * Return true if at least one account is still paid until now
  *
  * @param Collection $keys
  * @return bool
  */
 protected function isActive(Collection $keys)
 {
     // iterate over keys and compare the paidUntil field value to current date
     foreach ($keys as $key) {
         if (AccountStatus::where('keyID', $key->key_id)->whereDate('paidUntil', '>=', date('Y-m-d'))->count() > 0) {
             return true;
         }
     }
     return false;
 }