@param int $character_id

@return \Illuminate\Support\Collection
969145
public function getCharacterPlanetaryExtractors(int $character_id): Collection
    {

        $extractors = CharacterPlanet::where('character_planets.character_id', $character_id)
            ->join('character_planet_extractors', function ($join) {
                $join->on('character_planet_extractors.planet_id', '=', 'character_planets.planet_id')
                    ->on('character_planet_extractors.character_id', '=', 'character_planets.character_id');
            })
            ->join('character_planet_pins', function ($join) {
                $join->on('character_planet_pins.pin_id', '=', 'character_planet_extractors.pin_id')
                    ->on('character_planet_pins.planet_id', '=', 'character_planet_extractors.planet_id')
                    ->on('character_planet_pins.character_id', '=', 'character_planet_extractors.character_id');
            })
            ->join('mapDenormalize as planet',
                'planet.itemID', '=', 'character_planets.planet_id')
            ->join('mapDenormalize as system',
                'system.itemID', '=', 'character_planets.solar_system_id')
            ->join('invTypes',
                'invTypes.typeID', '=', 'character_planet_extractors.product_type_id')
            ->select(
                'character_planet_extractors.product_type_id', // Extractor Product Name f.e. Aqueous Liquids
                'planet.celestialIndex', // arabic planet index
                'planet.itemName', // Planet Name
                'planet.typeID', // Planet Type ID
                'system.itemName', // System Name
                'character_planet_pins.install_time', //UTC Time of start
                'character_planet_pins.expiry_time', // UTC Time of expiry
                'character_planets.planet_type', // barren, temperate, gas
                'invTypes.typeName' // Extractor Product Name
            )
            ->get();

        return $extractors->map(function ($item) {

            $item->celestialIndex = number_roman($item->celestialIndex);

            return $item;
        });
    }
1309117
public function getCharacter4Id($id)
    {
        /** @var \GameBackend\Entity\CrossFire\Repository\Character $repository */
        $repository = $this->getAccountEntityManager()->getRepository($this->getGameOptions()->getEntityCharacterClass());
        return $repository->getCharacter4Id($id);
    }
773090
public function getNotesData(int $character_id)
    {

        return DataTables::of(CharacterInfo::getNotes($character_id))
            ->addColumn('actions', function ($row) {

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

    }
164794
public function getTransactionContent(int $character_id, int $client_id)
    {

        $transactions = $this->characterWalletTransactionInteraction($character_id, $client_id);

        return DataTables::of($transactions)
            ->editColumn('is_buy', function ($row) {

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

                return number($row->unit_price);
            })
            ->addColumn('item_view', function ($row) {
                return view('web::partials.transactiontype', compact('row'));
            })
            ->addColumn('total', function ($row) {

                return number($row->unit_price * $row->quantity);
            })
            ->addColumn('client_view', function ($row) {

                $character_id = $row->character_id;

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

                return view('web::partials.character', compact('character', 'character_id'));
            })
            ->rawColumns(['is_buy', 'client_view', 'item_view'])
            ->make(true);
    }
583185
public function getTransactionsData(int $character_id)
    {

        if (! request()->has('all_linked_characters'))
            return abort(500);

        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;

        $transactions = $this->getCharacterWalletTransactions($character_ids);

        return DataTables::of($transactions)
            ->editColumn('is_buy', function ($row) {

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

                return number($row->unit_price);
            })
            ->addColumn('item_view', function ($row) {
                return view('web::partials.transactiontype', compact('row'));
            })
            ->addColumn('total', function ($row) {

                return number($row->unit_price * $row->quantity);
            })
            ->addColumn('client_view', function ($row) {

                $character_id = $row->character_id;

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

                return view('web::partials.character', compact('character', 'character_id'));
            })
            ->rawColumns(['is_buy', 'client_view', 'item_view'])
            ->make(true);

    }
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();

    }
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();

    }
1363446
public function characterTopMailInteractions(Collection $character_ids) : Builder
    {

        return MailHeader::select()
            ->selectRaw('count(`from`) as total')
            ->whereIn('character_id', $character_ids->toArray())
            ->whereColumn('character_id', '<>', 'from')
            ->groupBy('from')
            ->orderBy('total', 'desc');

    }
892345
private function getIntelView(string $type, int $character_id, int $first_other_id, int $second_other_id = null) : string
    {
        $universe_name = $this->getUniverseNameResolved($character_id, $first_other_id, $second_other_id);

        if($type === 'character')
            return $this->getCharacterIntelView($universe_name, $character_id);

        if($type === 'corporation')
            return $this->getCorporationIntelView($universe_name, $character_id);

        if($type === 'alliance')
            return $this->getAllianceIntelView($universe_name, $character_id);

        return '';

    }
1063947
public function getDispatchUpdateJob(int $character_id, string $job_name)
    {

        $job_classes = collect(config('web.jobnames.' . $job_name));

        // If we could not find the jon to dispatch, log this as a
        // security event as someone might be trying something funny.
        if ($job_classes->isEmpty()) {

            $message = 'Failed to find the jobclass for job_name ' . $job_name .
                ' Someone might be trying something strange.';

            event('security.log', [$message, 'jobdispatching']);

            return redirect()->back()->with('warning', trans('web::seat.update_failed'));
        }

        // Find the refresh token for the jobs.
        $refresh_token = RefreshToken::findOrFail($character_id);

        // Dispatch jobs for each jobclass
        $job_classes->each(function ($job) use ($refresh_token, $character_id) {

            (new $job($refresh_token))->dispatch($refresh_token)->onQueue('high');

            logger()->info('Manually dispatched job \'' . $job . '\' for character ' .
                $character_id);
        });

        // Redirect back!
        return redirect()->back()->with('success', trans('web::seat.update_dispatched'));
    }
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'));
    }
465994
public function characterWalletJournalInteractions(int $first_party_id, int $second_party_id) : Builder
    {

        return CharacterWalletJournal::with('first_party', 'second_party')
            ->where('first_party_id', '=', $first_party_id)
            ->where('second_party_id', '=', $second_party_id);

    }
1347968
public function getCharacterPlanetaryColonies(int $character_id): Collection
    {

        return CharacterPlanet::where('character_id', $character_id)
            ->join('mapDenormalize as system', 'system.itemID', '=', 'solar_system_id')
            ->join('mapDenormalize as planet', 'planet.itemID', '=', 'planet_id')
            ->select('character_planets.*', 'system.itemName', 'planet.typeID')
            ->get();
    }
358470
public function getCharacterJumpClones(int $character_id): Collection
    {

        return DB::table(DB::raw(
            'character_jump_clones as a'))
            ->select(DB::raw('
                *, CASE
                when a.location_id BETWEEN 66015148 AND 66015151 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=a.location_id-6000000)
                when a.location_id BETWEEN 66000000 AND 66014933 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=a.location_id-6000001)
                when a.location_id BETWEEN 66014934 AND 67999999 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id=a.location_id-6000000)
                when a.location_id BETWEEN 60014861 AND 60014928 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id=a.location_id)
                when a.location_id BETWEEN 60000000 AND 61000000 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=a.location_id)
                when a.location_id>=61000000 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id=a.location_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                    WHERE m.itemID=a.location_id) end
                    AS location,a.location_id AS locID'))
            ->where('a.character_id', $character_id)
            ->get();
    }
1320076
public function getMailData(int $character_id)
    {

        if (! request()->has('all_linked_characters'))
            return abort(500);

        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;

        $mail = $this->getCharacterMail($character_ids);

        return DataTables::of($mail)
            ->editColumn('from', function ($row) {

                $character_id = $row->character_id;

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

                return view('web::partials.character', compact('character', 'character_id'));
            })
            ->editColumn('subject', function ($row) {

                return view('web::character.partials.mailtitle', compact('row'));
            })
            ->editColumn('tocounts', function ($row) {

                return view('web::character.partials.mailtocounts', compact('row'));
            })
            ->addColumn('read', function ($row) {

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

            })
            ->rawColumns(['from', 'subject', 'tocounts', 'read'])
            ->make(true);

    }
1253021
public function AnimeCharactersAndStaff(int $id): Model\Anime\AnimeCharactersAndStaff
    {
        return $this->myanimelist->getAnimeCharactersAndStaff(
            new Request\Anime\AnimeCharactersAndStaffRequest($id)
        );
    }
979811
public function getCharacterContracts(Collection $character_ids) : Builder
    {

        return DB::table(DB::raw('contract_details as a'))
            ->select(DB::raw(
                '
                --
                -- All Columns
                --
                *,

                --
                -- Start Location Lookup
                --
                CASE
                when a.start_location_id BETWEEN 66015148 AND 66015151 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID = a.start_location_id-6000000)
                when a.start_location_id BETWEEN 66000000 AND 66014933 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID = a.start_location_id-6000001)
                when a.start_location_id BETWEEN 66014934 AND 67999999 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id = a.start_location_id-6000000)
                when a.start_location_id BETWEEN 60014861 AND 60014928 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id = a.start_location_id)
                when a.start_location_id BETWEEN 60000000 AND 61000000 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID = a.start_location_id)
                when a.start_location_id >= 61000000 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id = a.start_location_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                    WHERE m.itemID = a.start_location_id) end
                AS startlocation,

                --
                -- End Location Lookup
                --
                CASE
                when a.end_location_id BETWEEN 66015148 AND 66015151 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID = a.end_location_id-6000000)
                when a.end_location_id BETWEEN 66000000 AND 66014933 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID = a.end_location_id-6000001)
                when a.end_location_id BETWEEN 66014934 AND 67999999 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id = a.end_location_id-6000000)
                when a.end_location_id BETWEEN 60014861 AND 60014928 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id = a.end_location_id)
                when a.end_location_id BETWEEN 60000000 AND 61000000 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID = a.end_location_id)
                when a.end_location_id >= 61000000 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id = a.end_location_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                    WHERE m.itemID = a.end_location_id) end
                AS endlocation '))
            ->join('character_contracts', 'character_contracts.contract_id', '=', 'a.contract_id')
            ->whereIn('character_contracts.character_id', $character_ids->toArray());

    }