/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { // Instead of using the 'exists' validation rule, we opt to use // the 'in' rule. We do this because we want to add '0' as a valid // value, which will signal a wild card for either all characters // or all corporations. $character_ids = implode(',', array_prepend(ApiKeyInfoCharacters::pluck('characterID')->toArray(), 0)); $corporation_ids = implode(',', array_prepend(CorporationSheet::pluck('corporationID')->toArray(), 0)); return ['id' => 'required|numeric|exists:notification_groups,id', 'characters' => 'required_without_all:corporations', 'corporations' => 'required_without_all:characters', 'characters.*' => 'in:' . $character_ids, 'corporations.*' => 'in:' . $corporation_ids]; }
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')); }
/** * Run the Update * * @return mixed|void */ public function call() { $pheal = $this->setScope('corp')->setCorporationID()->getPheal(); $result = $pheal->CorporationSheet(); $corporation_sheet = CorporationSheetModel::firstOrNew(['corporationID' => $this->corporationID]); $corporation_sheet->fill(['corporationName' => $result->corporationName, 'ticker' => $result->ticker, 'ceoID' => $result->ceoID, 'ceoName' => $result->ceoName, 'stationID' => $result->stationID, 'stationName' => $result->stationName, 'description' => $result->description, 'url' => $result->url, 'allianceID' => $result->allianceID, 'factionID' => $result->factionID, 'allianceName' => $result->allianceName, 'memberCount' => $result->memberCount, 'memberLimit' => $result->memberLimit, 'shares' => $result->shares, 'graphicID' => $result->logo->graphicID, 'shape1' => $result->logo->shape1, 'shape2' => $result->logo->shape2, 'shape3' => $result->logo->shape3, 'color1' => $result->logo->color1, 'color2' => $result->logo->color2, 'color3' => $result->logo->color3]); $corporation_sheet->save(); // Update the Divisional Information foreach ($result->divisions as $division) { $division_info = CorporationSheetDivision::firstOrNew(['corporationID' => $this->corporationID, 'accountKey' => $division->accountKey]); $division_info->fill(['description' => $division->description]); $division_info->save(); } // Update Wallet Divisions Information foreach ($result->walletDivisions as $wallet_division) { $wallet_division_info = CorporationSheetWalletDivision::firstOrNew(['corporationID' => $this->corporationID, 'accountKey' => $wallet_division->accountKey]); $wallet_division_info->fill(['description' => $wallet_division->description]); $wallet_division_info->save(); } return; }
/** * Return the Corporation Sheet for a Corporation * * @param $corporation_id * * @return mixed */ public function getCorporationSheet($corporation_id) { return CorporationSheet::where('corporationID', $corporation_id)->first(); }
public function testCorporation() { $permission = SlackChannelCorporation::where('corporation_id', '=', 98413060)->first(); $artifact = CorporationSheet::find(98413060); $this->assertEquals($artifact, $permission->corporation); }