@param int $character_id

@return mixed
@throws \Exception
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);

    }
346255
public function getCharacter4Id($id)
    {
        /** @var \GameBackend\Entity\SRO\Shard\Repository\Character $repository */
        $repository = $this->getShardEntityManager()->getRepository($this->getGameOptions()->getEntityShardCharacter());
        return $repository->getCharacter4Id($id, $this->getNotListedJIDList());
    }
332545
public function getFittingItems(int $character_id, int $fitting_id)
    {

        $fitting = $this->getCharacterFitting($character_id, $fitting_id);
        $items = $this->getCharacterFittingItems($fitting_id);

        return view('web::character.fittingitems', compact('fitting', 'items'));
    }
1280970
public function getJournalData(int $corporation_id)
    {
        if (! request()->has('division'))
            return abort(500);

        $journal = $this->getCorporationWalletJournal($corporation_id, (int) request('division'));

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

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

                $character_id = $row->character_id;

                if (optional($row->first_party)->category === 'character') {

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

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

                if (optional($row->first_party)->category === 'corporation'){

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

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

                return view('web::partials.unknown', [
                    'unknown_id' => $row->first_party_id,
                    'character_id' => $character_id,
                ]);
            })
            ->editColumn('second_party_id', function ($row) {

                $character_id = $row->character_id;

                if (optional($row->second_party)->category === 'character') {

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

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

                if (optional($row->second_party)->category === 'corporation') {

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

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

                return view('web::partials.unknown', [
                    'unknown_id' => $row->second_party_id,
                    'character_id' => $character_id,
                ]);
            })
            ->editColumn('amount', function ($row) {

                return number($row->amount);
            })
            ->editColumn('balance', function ($row) {

                return number($row->balance);
            })
            ->rawColumns(['ref_type', 'first_party_id', 'second_party_id'])
            ->make(true);

    }
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'));
    }
269437
public function getCharacterSkillCoverage(int $character_id): Collection
    {

        $in_game_skills = DB::table('invTypes')
            ->join(
                'invMarketGroups',
                'invMarketGroups.marketGroupID', '=', 'invTypes.marketGroupID'
            )
            ->where('parentGroupID', '?')// binding at [1]
            ->select(
                'marketGroupName',
                DB::raw('COUNT(invTypes.marketGroupID) * 5 as amount')
            )
            ->groupBy('marketGroupName')
            ->toSql();

        $character_skills = CharacterSkill::join(
            'invTypes',
            'invTypes.typeID', '=',
            'character_skills.skill_id'
        )
            ->join(
                'invMarketGroups',
                'invMarketGroups.marketGroupID', '=',
                'invTypes.marketGroupID'
            )
            ->where('character_id', '?')// binding at [2]
            ->select(
                'marketGroupName',
                DB::raw('COUNT(invTypes.marketGroupID) * character_skills.trained_skill_level  as amount')
            )
            ->groupBy(['marketGroupName', 'trained_skill_level'])
            ->toSql();

        $skills = DB::table(
            DB::raw('(' . $in_game_skills . ') a')
        )
            ->leftJoin(
                DB::raw('(' . $character_skills . ') b'),
                'a.marketGroupName',
                'b.marketGroupName'
            )
            ->select(
                'a.marketGroupName',
                DB::raw('a.amount AS gameAmount'),
                DB::raw('SUM(b.amount) AS characterAmount')
            )
            ->groupBy(['a.marketGroupName', 'a.amount'])
            ->addBinding(150, 'select')// binding [1]
            ->addBinding($character_id, 'select')// binding [2]
            ->get();

        return $skills;
    }
379772
private function getCharacterId($char_name_area)
    {
        $char_id = $char_name_area->find('a', 0)->href;
        $char_id = explode('/', $char_id);

        return $char_id[4];
    }
1273633
private function getCharacter()
    {
        $character = [];
        $char_index = 0;
        $character_area = $this->_parser->find('div[class^=detail-characters-list]', 0);
        if ($character_area) {
            $character_list = [
                $character_area->find('div[class*=fl-l]', 0),
                $character_area->find('div[class*=fl-r]', 0),
            ];
            foreach ($character_list as $character_side) {
                if ($character_side) {
                    foreach ($character_side->find('table[width=100%]') as $each_char) {
                        $char = $each_char->find('tr td', 1);
                        $va = $each_char->find('table td', 0);

                        $character[$char_index]['id'] = $this->getStaffId($char);
                        $character[$char_index]['name'] = $this->getStaffName($char);
                        $character[$char_index]['role'] = $this->getStaffRole($char);
                        $character[$char_index]['image'] = $this->getStaffImage($each_char);

                        $character[$char_index]['va_id'] = $character[$char_index]['va_name'] = '';
                        $character[$char_index]['va_role'] = $character[$char_index]['va_image'] = '';

                        if ($va) {
                            $character[$char_index]['va_id'] = $this->getStaffId($va);
                            $character[$char_index]['va_name'] = $this->getStaffName($va, true);
                            $character[$char_index]['va_role'] = $this->getStaffRole($va);
                            $character[$char_index]['va_image'] = $this->getStaffImage($each_char, true);
                        }

                        $char_index++;
                    }
                }
            }
        }

        return $character;
    }
916833
public static function compare($charA, $charB): int
    {
        self::handleIncomingChar($charA, $charB);

        return (string) $charA <=> (string) $charB;
    }
17952
public function Character(int $id): Model\Character\Character
    {
        return $this->myanimelist->getCharacter(
            new Request\Character\CharacterRequest($id)
        );
    }
38644
public function CharacterPictures(int $id): array
    {
        return $this->myanimelist->getCharacterPictures(
            new Request\Character\CharacterPicturesRequest($id)
        );
    }
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'));
    }
895788
protected function beforeCiiAction($id=NULL)
    {
        // If we do not have an ID, consider it to be null, and throw a 404 error
        if ($id == NULL)
            throw new CHttpException(404, Yii::t('ciims.core', 'The specified post cannot be found.'));
        
        // Retrieve the HTTP Request
        $r = new CHttpRequest();
        
        // Retrieve what the actual URI
        $requestUri = str_replace($r->baseUrl, '', $r->requestUri);
        
        // Retrieve the route
        $route = '/' . $this->getRoute() . '/' . $id;
        $requestUri = preg_replace('/\?(.*)/','',$requestUri);
        
        // If the route and the uri are the same, then a direct access attempt was made, and we need to block access to the controller
        if ($requestUri == $route)
            throw new CHttpException(404, Yii::t('ciims.core', 'The requested post cannot be found.'));
        
        return str_replace($r->baseUrl, '', $r->requestUri);
    }
531196
public function star($id)
    {
        $id = (int) $id;
        if ($id <= 0) {
            throw new Exception('Invalid param id');
        }
        return $this->rest->put("$this->action/$id/star");
    }
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);

    }
487409
private String getIdentityFromLegacyId() throws CharacterCodingException {
        byte[] data = legacyId;
        int len = Util.toShort(data, 1);
        return Util.decodeString(data, 3, len);
    }
818595
public function getPi(int $character_id)
    {

        $colonies = $this->getCharacterPlanetaryColonies($character_id);
        $extractors = $this->getCharacterPlanetaryExtractors($character_id);

        // TODO: Complete the Links and stuff™

        return view('web::character.pi', compact('colonies', 'extractors'));
    }