Beispiel #1
0
 /**
  * Return the Member Tracking for a Corporation
  *
  * @param int $corporation_id
  *
  * @return \Illuminate\Support\Collection
  */
 public function getCorporationMemberTracking(int $corporation_id) : Collection
 {
     return MemberTracking::select('corporation_member_trackings.*', 'account_api_key_info_characters.*', 'eve_api_keys.enabled')->leftJoin('account_api_key_info_characters', function ($join) {
         $join->on('corporation_member_trackings.characterID', '=', 'account_api_key_info_characters.characterID');
     })->leftJoin('eve_api_keys', function ($join) {
         $join->on('account_api_key_info_characters.keyID', '=', 'eve_api_keys.key_id');
     })->where('corporation_member_trackings.corporationID', $corporation_id)->groupBy('corporation_member_trackings.characterID')->get();
 }
Beispiel #2
0
 /**
  * Run the Update
  *
  * @return mixed|void
  */
 public function call()
 {
     $pheal = $this->setScope('corp')->setCorporationID()->getPheal();
     $result = $pheal->MemberTracking(['extended' => 1]);
     foreach ($result->members as $member) {
         $member_info = MemberTrackingModel::firstOrNew(['corporationID' => $this->corporationID, 'characterID' => $member->characterID]);
         $member_info->fill(['name' => $member->name, 'startDateTime' => $member->startDateTime, 'baseID' => $member->baseID, 'base' => $member->base, 'title' => $member->title, 'logonDateTime' => $member->logonDateTime, 'logoffDateTime' => $member->logoffDateTime, 'locationID' => $member->locationID, 'location' => $member->location, 'shipTypeID' => $member->shipTypeID, 'shipType' => $member->shipType, 'roles' => $member->roles, 'grantableRoles' => $member->grantableRoles]);
         $member_info->save();
     }
     // Cleanup members no longer in this corporation
     MemberTrackingModel::where('corporationID', $this->corporationID)->whereNotIn('characterID', array_map(function ($member) {
         return $member->characterID;
     }, (array) $result->members))->delete();
     return;
 }
 /**
  * Return the Member Tracking for a Corporation
  *
  * @param $corporation_id
  *
  * @return mixed
  */
 public function getCorporationMemberTracking($corporation_id)
 {
     return MemberTracking::select('corporation_member_trackings.*', 'eve_api_keys.enabled')->leftJoin('account_api_key_info_characters', 'corporation_member_trackings.characterID', '=', 'account_api_key_info_characters.characterID')->leftJoin('eve_api_keys', 'account_api_key_info_characters.keyID', '=', 'eve_api_keys.key_id')->where('corporation_member_trackings.corporationID', $corporation_id)->groupBy('corporation_member_trackings.characterID')->orderBy('name')->get();
 }
 /**
  * Return the Member Tracking for a Corporation
  *
  * @param $corporation_id
  *
  * @return mixed
  */
 public function getCorporationMemberTracking($corporation_id)
 {
     return MemberTracking::select('corporation_member_trackings.*')->selectSub(function ($query) {
         // Get the key status for the character
         return $query->from('eve_api_keys')->select('enabled')->join('account_api_key_infos', 'eve_api_keys.key_id', '=', 'account_api_key_infos.keyID')->join('account_api_key_info_characters', 'eve_api_keys.key_id', '=', 'account_api_key_info_characters.keyID')->where('account_api_key_infos.type', '!=', 'Corporation')->where('account_api_key_info_characters.characterID', $query->raw('corporation_member_trackings.characterID'))->groupBy('corporation_member_trackings.characterID');
     }, 'enabled')->leftJoin('account_api_key_info_characters', 'corporation_member_trackings.characterID', '=', 'account_api_key_info_characters.characterID')->leftJoin('eve_api_keys', 'account_api_key_info_characters.keyID', '=', 'eve_api_keys.key_id')->where('corporation_member_trackings.corporationID', $corporation_id)->groupBy('corporation_member_trackings.characterID')->orderBy('name')->get();
 }
 /**
  * The required method to handle the Alert.
  *
  * @return mixed
  */
 protected function getData() : Collection
 {
     return MemberTracking::where('logoffDateTime', '<', DB::raw('date_sub(NOW(), INTERVAL 3 MONTH)'))->get();
 }