src/Repositories/Corporation/Assets.php
public function getCorporationAssets(int $corporation_id): Collection
    {

        return CorporationAsset::with('content', 'type')
            ->select(DB::raw('
                --
                -- Select All Fields
                --
                *,

                --
                -- Start the location lookup
                --
                CASE
                when corporation_assets.location_id BETWEEN 66015148 AND 66015151 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=corporation_assets.location_id-6000000)
                when corporation_assets.location_id BETWEEN 66000000 AND 66014933 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=corporation_assets.location_id-6000001)
                when corporation_assets.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=corporation_assets.location_id-6000000)
                when corporation_assets.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=corporation_assets.location_id)
                when corporation_assets.location_id BETWEEN 60000000 AND 61000000 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=corporation_assets.location_id)
                when corporation_assets.location_id BETWEEN 61000000 AND 61001146 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id=corporation_assets.location_id)
                when corporation_assets.location_id > 61001146 then
                    (SELECT name FROM `universe_structures` AS c
                     WHERE c.structure_id = corporation_assets.location_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                    WHERE m.itemID=corporation_assets.location_id) end
                AS location_name'))
            ->whereIn('location_flag', [
                // These locations look like they are top-level. Even though 'OfficeFolder' is
                // top level, lets just flatten it anyways.
                'AssetSafety', 'OfficeFolder', 'Impounded', 'CorpDeliveries',
            ])
            ->where('corporation_assets.corporation_id', $corporation_id)
            ->get();

    }
public function getCorporationAssets(int $corporation_id): Collection
    {

        return CorporationAsset::with('content', 'type')
            ->select(DB::raw('
                --
                -- Select All Fields
                --
                *,

                --
                -- Start the location lookup
                --
                CASE
                when corporation_assets.location_id BETWEEN 66015148 AND 66015151 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=corporation_assets.location_id-6000000)
                when corporation_assets.location_id BETWEEN 66000000 AND 66014933 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=corporation_assets.location_id-6000001)
                when corporation_assets.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=corporation_assets.location_id-6000000)
                when corporation_assets.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=corporation_assets.location_id)
                when corporation_assets.location_id BETWEEN 60000000 AND 61000000 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=corporation_assets.location_id)
                when corporation_assets.location_id BETWEEN 61000000 AND 61001146 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id=corporation_assets.location_id)
                when corporation_assets.location_id > 61001146 then
                    (SELECT name FROM `universe_structures` AS c
                     WHERE c.structure_id = corporation_assets.location_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                    WHERE m.itemID=corporation_assets.location_id) end
                AS location_name'))
            ->whereIn('location_flag', [
                // These locations look like they are top-level. Even though 'OfficeFolder' is
                // top level, lets just flatten it anyways.
                'AssetSafety', 'OfficeFolder', 'Impounded', 'CorpDeliveries',
            ])
            ->where('corporation_assets.corporation_id', $corporation_id)
            ->get();

    }
public function getCorporationAssets ( int $ corporation_id ) : Collection { return CorporationAsset :: with ( 'content' , 'type' ) -> select ( DB :: raw ( '
                --
                -- Select All Fields
                --
                *,

                --
                -- Start the location lookup
                --
                CASE
                when corporation_assets.location_id BETWEEN 66015148 AND 66015151 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=corporation_assets.location_id-6000000)
                when corporation_assets.location_id BETWEEN 66000000 AND 66014933 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=corporation_assets.location_id-6000001)
                when corporation_assets.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=corporation_assets.location_id-6000000)
                when corporation_assets.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=corporation_assets.location_id)
                when corporation_assets.location_id BETWEEN 60000000 AND 61000000 then
                    (SELECT s.stationName FROM staStations AS s
                      WHERE s.stationID=corporation_assets.location_id)
                when corporation_assets.location_id BETWEEN 61000000 AND 61001146 then
                    (SELECT d.name FROM `sovereignty_structures` AS c
                      JOIN universe_stations d ON c.structure_id = d.station_id
                      WHERE c.structure_id=corporation_assets.location_id)
                when corporation_assets.location_id > 61001146 then
                    (SELECT name FROM `universe_structures` AS c
                     WHERE c.structure_id = corporation_assets.location_id)
                else (SELECT m.itemName FROM mapDenormalize AS m
                    WHERE m.itemID=corporation_assets.location_id) end
                AS location_name' ) ) -> whereIn ( 'location_flag' , [ // These locations look like they are top-level. Even though 'OfficeFolder' is // top level, lets just flatten it anyways. 'AssetSafety' , 'OfficeFolder' , 'Impounded' , 'CorpDeliveries' , ] ) -> where ( 'corporation_assets.corporation_id' , $ corporation_id ) -> get ( ) ; }
Return the assets list for a Corporation.

@param int $corporation_id

@return \Illuminate\Support\Collection
Return the assets list for a Corporation .