Пример #1
0
 /**
  * Run the Update
  *
  * @return mixed|void
  */
 public function call()
 {
     $pheal = $this->setScope('corp')->setCorporationID()->getPheal();
     $result = $pheal->MemberSecurity();
     foreach ($result->members as $member) {
         // Update the membe that is currently in scope
         $this->member = $member;
         // Cleanup the known roles for this character
         MemberSecurityModel::where('characterID', $member->characterID)->delete();
         // Write the new roles
         $this->writeEntry($member->roles, 'roles');
         $this->writeEntry($member->grantableRoles, 'grantableRoles');
         $this->writeEntry($member->rolesAtHQ, 'rolesAtHQ');
         $this->writeEntry($member->grantableRolesAtHQ, 'grantableRolesAtHQ');
         $this->writeEntry($member->rolesAtBase, 'rolesAtBase');
         $this->writeEntry($member->grantableRolesAtBase, 'grantableRolesAtBase');
         $this->writeEntry($member->rolesAtOther, 'rolesAtOther');
         $this->writeEntry($member->grantableRolesAtOther, 'grantableRolesAtOther');
         // Lastly, cleanup and add the titles
         MemberSecurityTitle::where('characterID', $member->characterID)->delete();
         // Only set titles if the API response had some
         if ($member->titles) {
             foreach ($member->titles as $title) {
                 MemberSecurityTitle::create(['corporationID' => $this->getCorporationID(), 'characterID' => $member->characterID, 'characterName' => $member->name, 'titleID' => $title->titleID, 'titleName' => $title->titleName]);
             }
         }
     }
     // Foreach member
     return;
 }
Пример #2
0
 /**
  * Get the titles for a Corporation
  *
  * @param $corporation_id
  *
  * @return mixed
  */
 public function getCorporationMemberSecurityTitles($corporation_id)
 {
     return MemberSecurityTitle::where('corporationID', $corporation_id)->get();
 }