Example #1
0
 /**
  * Run the Update
  */
 public function call()
 {
     $result = $this->setScope('eve')->getPheal()->AllianceList();
     foreach ($result->alliances as $alliance) {
         $alliance_data = AllianceListModel::firstOrNew(['allianceID' => $alliance->allianceID]);
         $alliance_data->fill(['name' => $alliance->name, 'shortName' => $alliance->shortName, 'executorCorpID' => $alliance->executorCorpID, 'memberCount' => $alliance->memberCount, 'startDate' => $alliance->startDate]);
         $alliance_data->save();
         // Get a list of known corporationID's for this
         // alliance
         $known_corporations = AllianceListMemberCorporations::where('allianceID', $alliance->allianceID)->lists('corporationID')->all();
         // Populate the member corporations for the current
         // alliance if the corporationID is not in the
         // known_corporations list
         foreach ($alliance->memberCorporations as $corporation) {
             if (!in_array($corporation->corporationID, $known_corporations)) {
                 AllianceListMemberCorporations::create(['allianceID' => $alliance->allianceID, 'corporationID' => $corporation->corporationID, 'startDate' => $corporation->startDate]);
             }
         }
         // Cleanup Corporations that are no longer part
         // of this alliance
         AllianceListMemberCorporations::where('allianceID', $alliance->allianceID)->whereNotIn('corporationID', array_map(function ($corporation) {
             return $corporation->corporationID;
         }, (array) $alliance->memberCorporations))->delete();
     }
     return;
 }
Example #2
0
 public function getRelations()
 {
     $channelPublic = SlackChannelPublic::all();
     $channelUsers = SlackChannelUser::all();
     $channelRoles = SlackChannelRole::all();
     $channelCorporations = SlackChannelCorporation::all();
     $channelAlliances = SlackChannelAlliance::all();
     $users = User::all();
     $roles = Role::all();
     $corporations = CorporationSheet::all();
     $alliances = AllianceList::all();
     $channels = SlackChannel::all();
     return view('slackbot::list', compact('channelPublic', 'channelUsers', 'channelRoles', 'channelCorporations', 'channelAlliances', 'users', 'roles', 'corporations', 'alliances', 'channels'));
 }
 public function testAlliance()
 {
     $permission = SlackChannelAlliance::where('alliance_id', '=', 99000006)->first();
     $artifact = AllianceList::find(99000006);
     $this->assertEquals($artifact, $permission->alliance);
 }