src/Repositories/Corporation/Industry.php
public function getCorporationIndustry(int $corporation_id, bool $get = true)
    {

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

                --
                -- Start Facility Name Lookup
                --
                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 c.name FROM `universe_structures` AS c
                      WHERE c.structure_id = a.location_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                WHERE m.itemID = a.location_id) end
                AS facilityName'))
            ->leftJoin(
                'ramActivities',
                'ramActivities.activityID', '=',
                'a.activity_id')// corporation_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.corporation_id', $corporation_id);

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

        return $industry;

    }
public function getCorporationIndustry(int $corporation_id, bool $get = true)
    {

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

                --
                -- Start Facility Name Lookup
                --
                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 c.name FROM `universe_structures` AS c
                      WHERE c.structure_id = a.location_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                WHERE m.itemID = a.location_id) end
                AS facilityName'))
            ->leftJoin(
                'ramActivities',
                'ramActivities.activityID', '=',
                'a.activity_id')// corporation_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.corporation_id', $corporation_id);

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

        return $industry;

    }
public function getCorporationIndustry ( int $ corporation_id , bool $ get = true ) { $ industry = DB :: table ( 'corporation_industry_jobs as a' ) -> select ( DB :: raw ( '
                a.*,
                ramActivities.*,
                blueprintType.typeName as blueprintTypeName,
                productType.typeName as productTypeName,

                --
                -- Start Facility Name Lookup
                --
                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 c.name FROM `universe_structures` AS c
                      WHERE c.structure_id = a.location_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                WHERE m.itemID = a.location_id) end
                AS facilityName' ) ) -> leftJoin ( 'ramActivities' , 'ramActivities.activityID' , '=' , 'a.activity_id' ) // corporation_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.corporation_id' , $ corporation_id ) ; if ( $ get ) return $ industry -> orderBy ( 'end_date' , 'desc' ) -> get ( ) ; return $ industry ; }
Return the Industry jobs for a Corporation.

@param int  $corporation_id
@param bool $get

@return \Illuminate\Support\Collection
Return the Industry jobs for a Corporation .