@param int $character_id
@param int $contract_id

@return mixed
437986
public function getCharacterContractsItems(int $character_id, int $contract_id): Collection
    {

        return ContractItem::join('invTypes',
            'contract_items.type_id', '=',
            'invTypes.typeID')
            ->join('invGroups',
                'invTypes.groupID', '=',
                'invGroups.groupID')
            ->join('character_contracts', 'character_contracts.contract_id', '=', 'contract_items.contract_id')
            ->where('character_id', $character_id)
            ->where('character_contracts.contract_id', $contract_id)
            ->get();

    }
126378
public function updateCode($code, $new_code, $card_id = null)
    {
        $data = ['code' => $code, 'new_code' => $new_code];
        is_null($card_id) || $data['card_id'] = $card_id;
        $url = "https://api.weixin.qq.com/card/code/update?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
155895
public function getContractsItemsData(int $corporation_id, int $contract_id)
    {

        $assets = $this->getCorporationContractsItems($corporation_id, $contract_id);

        return view('web::corporation.contractitems', compact('assets'));
    }
1335936
public function getCharacterFitting(int $character_id, int $fitting_id): CharacterFitting
    {

        return CharacterFitting::where('character_id', $character_id)
            ->where('fitting_id', $fitting_id)->first();

    }
1150885
public function getCharacterSkillsInformation(int $character_id): Collection
    {

        return CharacterSkill::join('invTypes',
            'character_skills.skill_id', '=',
            'invTypes.typeID')
            ->join('invGroups', 'invTypes.groupID', '=', 'invGroups.groupID')
            ->where('character_skills.character_id', $character_id)
            ->orderBy('invTypes.typeName')
            ->get();

    }
114896
public function getCharacterNotifications(int $character_id, int $chunk = 50): Collection
    {

        return CharacterNotification::where('character_id', $character_id)
            ->take($chunk)
            ->orderBy('timestamp', 'desc')
            ->get();
    }
698140
public function getCharacterStandings(int $character_id): Collection
    {

        return CharacterStanding::where('character_id', $character_id)
            ->leftJoin('chrFactions', 'from_id', '=', 'factionID')
            ->orderBy('from_type')
            ->get();
    }
1309117
public function getCharacter4Id($id)
    {
        /** @var \GameBackend\Entity\CrossFire\Repository\Character $repository */
        $repository = $this->getAccountEntityManager()->getRepository($this->getGameOptions()->getEntityCharacterClass());
        return $repository->getCharacter4Id($id);
    }
1093420
private function getCharacterIntelView(Collection $universe_name, int $character_id) : string
    {
        if ($universe_name->has('unknown_id'))
            return $this->getUnknownIntelView($universe_name);

        if (! $universe_name->has('character_id'))
            return '';

        $character = CharacterInfo::find($universe_name['character_id']) ?: $universe_name['character_id'];

        return view('web::partials.character', compact('character', 'character_id'));
    }
1197922
public function getCorporationContractsItems(int $corporation_id, int $contract_id): Collection
    {

        return ContractItem::leftJoin('invTypes',
            'contract_items.type_id', '=',
            'invTypes.typeID')
            ->join('invGroups',
                'invTypes.groupID', '=',
                'invGroups.groupID')
            ->join('corporation_contracts', 'corporation_contracts.contract_id', '=', 'contract_items.contract_id')
            ->where('corporation_id', $corporation_id)
            ->where('corporation_contracts.contract_id', $contract_id)
            ->take(150)// Limit to 150 for now. Some of these contracts are insanely big.
            ->get();

    }
1177791
public function getMailRead(int $character_id, int $message_id)
    {

        $message = $this->getCharacterMailMessage($character_id, $message_id);

        $from = CharacterInfo::find($message->from) ?: $message->from;

        $characters = $message
            ->recipients
            ->where('recipient_type', 'character')
            ->map(function ($recipient) {

                return CharacterInfo::find($recipient->recipient_id) ?: $recipient->recipient_id;
            });

        $corporations = $message
            ->recipients
            ->where('recipient_type', 'corporation')
            ->map(function ($recipient) {

                return CorporationInfo::find($recipient->recipient_id) ?: $recipient->recipient_id;
            });

        return view('web::character.mail-read', compact('message', 'from', 'characters', 'corporations'))
            ->render();

    }
1004549
public function getMethod($uid, $employee_id)
    {
        $result = $this->getMethodInternal(compact('uid', 'employee_id'));
        $statusCode = (int)$result[ 'statusCode' ];

        if ($statusCode === 200) {
            return $this->getResultAsArrayWithoutStatusCode($result);
        }

        $this->reportUnexpectedResponse($result, 1541006615);
    }
1128111
public function getCharacterSkillsCoverageChartData($character_id)
    {

        if ($character_id == 1) {
            return response()->json([]);
        }

        $data = $this->getCharacterSkillCoverage($character_id);

        $character = CharacterInfo::where('character_id', $character_id)->first();

        return response()->json([
            'labels'   => $data->map(function ($item) {

                return $item->marketGroupName;
            })->toArray(), // skills category
            'datasets' => [
                [
                    'label'                => $character->name,
                    'data'                 => $data->map(function ($item) {

                        return round($item->characterAmount / $item->gameAmount * 100, 2);  // character / in game rate
                    })->toArray(),
                    'fill'                 => true,
                    'backgroundColor'      => 'rgba(60,141,188,0.3)',
                    'borderColor'          => '#3c8dbc',
                    'pointBackgroundColor' => '#3c8dbc',
                    'pointBorderColor'     => '#fff',
                ],
            ],
        ]);
    }
154121
public function postAddNew(NewIntelNote $request, int $character_id)
    {

        CharacterInfo::addNote(
            $character_id, $request->input('title'), $request->input('note'));

        return redirect()->back()
            ->with('success', 'Note Added');

    }
177994
public function getContractsData(int $character_id)
    {
        if (! request()->ajax())
            return view('web::character.contacts');

        if (! request()->has('all_linked_characters'))
            return response('required url parameter is missing!', 400);

        if (request('all_linked_characters') === 'false')
            $character_ids = collect($character_id);

        $user_group = User::find($character_id)->group->users
            ->filter(function ($user) {

                return  $user->name !== 'admin' && $user->id !== 1;
            })
            ->pluck('id');

        if (request('all_linked_characters') === 'true')
            $character_ids = $user_group;

        $contracts = $this->getCharacterContracts($character_ids);

        return DataTables::of($contracts)
            ->editColumn('issuer_id', function ($row) {

                $character_id = $row->character_id;

                if ($row->for_corporation){

                    $corporation = CorporationInfo::find($row->issuer_corporation_id) ?: $row->issuer_corporation_id;
                    $character = CharacterInfo::find($row->issuer_id) ?: $row->issuer_id;

                    return view('web::partials.corporation', compact('corporation', 'character_id'))
                        . '<br/>(' . view('web::partials.character', compact('character', 'character_id')) . ')';
                }

                $character = CharacterInfo::find($row->issuer_id) ?: $row->issuer_id;

                return view('web::partials.character', compact('character', 'character_id'));

            })
            ->editColumn('assignee_id', function ($row) {

                if ($row->assignee_id === 0)
                    return  trans('web::seat.public');

                $character_id = $row->character_id;
                $character = CharacterInfo::find($row->assignee_id) ?: null;

                if (! is_null($character))
                    return view('web::partials.character', compact('character', 'character_id'));

                $corporation = CorporationInfo::find($row->assignee_id) ?: null;

                if (! is_null($corporation))
                    return view('web::partials.corporation', compact('corporation', 'character_id'));

                return view('web::partials.unknown', [
                    'unknown_id' => $row->assignee_id,
                    'character_id' => $row->character_id,
                ]);

            })
            ->editColumn('acceptor_id', function ($row) {

                if ($row->acceptor_id === 0)
                    return '';

                $character_id = $row->character_id;
                $character = CharacterInfo::find($row->acceptor_id) ?: null;

                if (! is_null($character))
                    return view('web::partials.character', compact('character', 'character_id'));

                $corporation = CorporationInfo::find($row->acceptor_id) ?: null;

                if (! is_null($corporation))
                    return view('web::partials.corporation', compact('corporation', 'character_id'));

                return view('web::partials.unknown', [
                    'unknown_id' => $row->acceptor_id,
                    'character_id' => $row->character_id,
                ]);

            })
            ->editColumn('type', function ($row) {

                return view('web::partials.contracttype', compact('row'))
                    ->render();
            })
            ->editColumn('price', function ($row) {

                return number($row->price);
            })
            ->editColumn('reward', function ($row) {

                return number($row->reward);
            })
            ->editColumn('collateral', function ($row) {

                return number($row->collateral);
            })
            ->addColumn('contents', function ($row) {

                return view('web::partials.contractcontentsbutton', compact('row'));
            })
            ->addColumn('is_in_group', function ($row) use ($user_group) {

                if (in_array($row->issuer_id, $user_group->toArray()) && in_array($row->acceptor_id, $user_group->toArray()))
                    return true;

                if (in_array($row->issuer_id, $user_group->toArray()) && in_array($row->assignee_id, $user_group->toArray()))
                    return true;

                return false;
            })
            ->filterColumn('issuer_id', function ($query, $keyword) {

                $query->whereIn('a.issuer_id', $this->getIdsForNames($keyword)->toArray());
            })
            ->filterColumn('assignee_id', function ($query, $keyword) {

                $query->whereIn('a.assignee_id', $this->getIdsForNames($keyword)->toArray());
            })
            ->filterColumn('acceptor_id', function ($query, $keyword) {

                $query->whereIn('a.acceptor_id', $this->getIdsForNames($keyword)->toArray());
            })
            ->rawColumns(['issuer_id', 'type', 'contents', 'assignee_id', 'acceptor_id'])
            ->make(true);

    }
1015100
public function getCompareStandingsWithProfileData(int $character_id, int $profile_id)
    {

        $journal = $this->getCharacterJournalStandingsWithProfile($character_id, $profile_id);

        return DataTables::of($journal)
            ->editColumn('characterName', function ($row) {

                return view('web::character.intel.partials.charactername', compact('row'))
                    ->render();
            })
            ->editColumn('corporationName', function ($row) {

                return view('web::character.intel.partials.corporationname', compact('row'))
                    ->render();
            })
            ->editColumn('allianceName', function ($row) {

                return view('web::character.intel.partials.alliancename', compact('row'))
                    ->render();
            })
            ->rawColumns(['characterName', 'corporationName', 'allianceName'])
            ->make(true);

    }
367807
public function getSkills(int $character_id)
    {

        $skills = $this->getCharacterSkillsInformation($character_id);
        $skill_groups = $this->getEveSkillsGroups();

        return view('web::character.skills',
            compact('skills', 'skill_groups'));
    }