@param int $character_id
@param int $fitting_id

@return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
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'));
    }
868543
public function getCharacterContacts(Collection $character_ids, array $standings): Builder
    {

        return CharacterContact::whereIn('character_contacts.character_id', $character_ids->toArray())
            ->whereIn('standing', $standings);
    }
751483
public function actionLike($id=NULL)
	{
		if ($id == NULL)
			throw new CHttpException(400, Yii::t('Api.content', 'Missing ID'));

		$model = new ContentMetadata;
		$content = $model->getPrototype('ContentMetadata', array('content_id' => $id, 'key' => 'likes'), array('value' => 0));

		if ($id === NULL || $content === NULL)
			throw new CHttpException(404, Yii::t('Api.content', 'No content entry with that ID was'));

		// Load the user likes, create one if it does not exist
		$user = $model->getPrototype('UserMetadata', array('user_id' => $this->user->id, 'key' => 'likes'), array('value' => '[]'));

		$likes = json_decode($user->value, true);

		$type = "inc";
		if (in_array($id, array_values($likes)))
		{
			$type = "dec";
			$content->value -= 1;
			
			if ($content->value <= 0)
				$content->value = 0;
				
			$element = array_search($id, $likes);
			unset($likes[$element]);
		}
		else
		{
			$content->value += 1;
			array_push($likes, $id);
		}

		$user->value = CJSON::encode($likes);

		if (!$user->save())
			throw new CHttpException(500, Yii::t('Api.content', 'Unable to save user like'));

		if (!$content->save())
			throw new CHttpException(500, Yii::t('Api.content', 'Unable to save like'));

		return array(
			'type' => $type
		);
	}
291283
public function characterTopWalletTransactionInteractions(Collection $character_ids) : Builder
    {

        return CharacterWalletTransaction::with('client')
            ->select()
            ->selectRaw('count(client_id) as total')
            ->whereIn('character_id', $character_ids->toArray())
            ->groupBy('client_id')
            ->orderBy('total', 'desc');

    }
980786
public function getKillmailsData(int $character_id)
    {

        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;

        $killmails = $this->getCharacterKillmails($character_ids);

        return DataTables::of($killmails)
            ->addColumn('victim', function ($row) {

                if (is_null($row->killmail_victim))
                    return '';

                $character_id = $row->character_id;

                $character = CharacterInfo::find($row->killmail_victim->character_id) ?: $row->killmail_victim->character_id;
                $corporation = CorporationInfo::find($row->killmail_victim->corporation_id) ?: $row->killmail_victim->corporation_id;

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

                $alliance = '';

                if (! empty($row->killmail_victim->alliance_id)) {
                    $alliance = view('web::partials.alliance', ['alliance' => $row->killmail_victim->alliance_id, 'character_id' => $character_id]);
                }

                    return $view . $alliance;
            })
            ->addColumn('ship', function ($row) {

                if (is_null($row->killmail_victim))
                    return '';

                $ship_type = $row->killmail_victim->ship_type;

                return view('web::partials.killmailtype', compact('ship_type'))
                    ->render();
            })
            ->addColumn('place', function ($row) {

                if (is_null($row->killmail_detail))
                    return '';

                $place = $row->killmail_detail->solar_system;

                return view('web::partials.killmailsystem', compact('place'))
                    ->render();
            })
            ->addColumn('zkb', function ($row) {

                return view('web::partials.killmailzkb', compact('row'))
                    ->render();
            })
            ->rawColumns(['victim', 'ship', 'place', 'zkb'])
            ->make(true);

    }
714244
public function actionPdf($id)
    {
        $model = $this->findModel($id);
        $providerCustomerBillingAddress = new \yii\data\ArrayDataProvider([
            'allModels' => $model->customerBillingAddresses,
        ]);
        $providerCustomerNote = new \yii\data\ArrayDataProvider([
            'allModels' => $model->customerNotes,
        ]);
        $providerCustomerReminders = new \yii\data\ArrayDataProvider([
            'allModels' => $model->customerReminders,
        ]);
        $providerCustomerShippingAddress = new \yii\data\ArrayDataProvider([
            'allModels' => $model->customerShippingAddresses,
        ]);
        $content = $this->renderAjax('_pdf', [
            'model'                           => $model,
            'providerCustomerBillingAddress'  => $providerCustomerBillingAddress,
            'providerCustomerNote'            => $providerCustomerNote,
            'providerCustomerReminders'       => $providerCustomerReminders,
            'providerCustomerShippingAddress' => $providerCustomerShippingAddress,
        ]);
        $pdf = new \kartik\mpdf\Pdf([
            'mode'        => \kartik\mpdf\Pdf::MODE_UTF8,
            'format'      => \kartik\mpdf\Pdf::FORMAT_A4,
            'orientation' => \kartik\mpdf\Pdf::ORIENT_PORTRAIT,
            'destination' => \kartik\mpdf\Pdf::DEST_BROWSER,
            'content'     => $content,
            'cssFile'     => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
            'cssInline'   => '.kv-heading-1{font-size:18px}',
            'options'     => ['title' => \Yii::$app->name],
            'methods'     => [
                'SetHeader' => [\Yii::$app->name],
                'SetFooter' => ['{PAGENO}'],
            ],
        ]);

        return $pdf->render();
    }
772228
public function postUpdateNote(UpdateIntelNote $request, int $character_id)
    {

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

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

    }
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);
    }
1176818
public List<StyleMappingRow> queryByBaseFeatureId(long id) {
		List<StyleMappingRow> rows = new ArrayList<>();
		UserCustomResultSet resultSet = queryByBaseId(id);
		try {
			while (resultSet.moveToNext()) {
				rows.add(getRow(resultSet));
			}
		} finally {
			resultSet.close();
		}
		return rows;
	}
500594
def receivable_id=(receivable_id)
      if receivable_id.nil?
        fail ArgumentError, "receivable_id cannot be nil"
      end

      if receivable_id.to_s.length < 1
        fail ArgumentError, "invalid value for 'receivable_id', the character length must be great than or equal to 1."
      end

      @receivable_id = receivable_id
    end
977195
public function getDetailedLedger(int $character_id, $date, int $system_id, int $type_id): JsonResponse
    {
        if (! request()->has('all_linked_characters'))
            return abort(500);

        $character_ids = collect($character_id);

        $entries = $this->getCharacterLedger($character_ids)
            ->addSelect('time', 'quantity')
            ->where('character_minings.date', $date)
            ->where('solar_system_id', $system_id)
            ->where('character_minings.type_id', $type_id)
            ->get();

        return DataTables::of($entries)
            ->removeColumn('solar_system_id')
            ->removeColumn('date')
            ->removeColumn('type_id')
            ->removeColumn('average_price')
            ->removeColumn('type')
            ->editColumn('quantity', function ($row) {

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

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

                $value = $row->average_price * $row->quantity;

                if(empty($value))
                    // If historical price has not been set, get historical price.
                    $value = $this->getHistoricalPrice($row->type_id, $row->date)->average_price;

                return view('web::partials.miningvalue', compact('value'));
            })
            ->rawColumns(['value', 'volume'])
            ->make(true);
    }
1277573
public function actionView($id)
    {
        $model = $this->findModel($id);
        $providerAuthAssignment = new \yii\data\ArrayDataProvider([
            'allModels' => $model->authAssignments,
        ]);
        $providerAuthItemChild = new \yii\data\ArrayDataProvider([
            'allModels' => $model->authItemChildren,
        ]);
        return $this->render('view', [
            'model' => $this->findModel($id),
            'providerAuthAssignment' => $providerAuthAssignment,
            'providerAuthItemChild' => $providerAuthItemChild,
        ]);
    }
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 '';

    }
306051
public function getCharacterIndustry(int $character_id, bool $get = true)
    {

        $industry = DB::table('character_industry_jobs as a')
            ->select(DB::raw('
                a.*,
                ramActivities.*,
                blueprintType.typeName as blueprintTypeName,
                productType.typeName as productTypeName,

                --
                -- Start Facility Name Lookup
                --
                CASE
                when a.station_id BETWEEN 66015148 AND 66015151 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID = a.station_id-6000000)
                when a.station_id BETWEEN 66000000 AND 66014933 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID = a.station_id-6000001)
                when a.station_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.station_id-6000000)
                when a.station_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.station_id)
                when a.station_id BETWEEN 60000000 AND 61000000 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID = a.station_id)
                when a.station_id >= 61000000 then
                    (SELECT c.name FROM `universe_structures` AS c
                      WHERE c.structure_id = a.station_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                WHERE m.itemID = a.station_id) end
                AS facilityName'))
            ->leftJoin(
                'ramActivities',
                'ramActivities.activityID', '=',
                'a.activity_id')// character_industry_jobs aliased to a
            ->join(
                'invTypes as blueprintType',
                'blueprintType.typeID', '=',
                'a.blueprint_type_id'
            )
            ->join(
                'invTypes as productType',
                'productType.typeID', '=',
                'a.product_type_id'
            )
            ->where('a.character_id', $character_id);

        if ($get)
            return $industry->orderBy('end_date', 'desc')
                ->get();

        return $industry;

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

    }
1139994
public function getCharacterResearchAgents(int $character_id): Collection
    {

        return CharacterAgentResearch::join(
            'invNames',
            'character_agent_researches.agent_id', '=',
            'invNames.itemID')
            ->join(
                'invTypes',
                'character_agent_researches.skill_type_id', '=',
                'invTypes.typeID')
            ->where('character_id', $character_id)
            ->get();
    }
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();
    }