From fb4e3e346290252c1c88fd93c3122826fd62f54c Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Sun, 20 Oct 2019 18:34:44 -0500 Subject: [PATCH] seeder and stations --- .../Dashboard/DashboardController.php | 5 +++++ app/Library/Lookups/LookupHelper.php | 19 ++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/Dashboard/DashboardController.php b/app/Http/Controllers/Dashboard/DashboardController.php index cdd889f..b828055 100644 --- a/app/Http/Controllers/Dashboard/DashboardController.php +++ b/app/Http/Controllers/Dashboard/DashboardController.php @@ -10,6 +10,11 @@ use App\Library\Contracts\ContractHelper; use App\Library\Lookups\LookupHelper; use App\Library\Esi\Esi; +//Models +use App\Models\Lookups\SolarSystem; +use App\Models\Lookups\SolarSystemDistance; +use App\Models\Lookups\StationLookup; + class DashboardController extends Controller { public function __construct() { diff --git a/app/Library/Lookups/LookupHelper.php b/app/Library/Lookups/LookupHelper.php index 9737e7e..4a400f7 100644 --- a/app/Library/Lookups/LookupHelper.php +++ b/app/Library/Lookups/LookupHelper.php @@ -722,16 +722,10 @@ class LookupHelper { return null; } - if(isset($station->type_id)) { - //Store the station details for the lookup table - $this->SaveStation($station); - //Return the details of the station - return $station; - } else { - //If we didn't get any details then return null - return null; - } - + //Save the station in the database + $this->SaveStation($station); + + return $station; } } @@ -744,15 +738,18 @@ class LookupHelper { //Run through the checks to try to find the station either by id first, then the name if($id != null) { $count = StationLookup::where(['station_id' => $id])->count(); + if($count > 0) { $station = StationLookup::where(['station_id' => $id])->get(); } else { return null; } + } else if( $name != null) { $count = StationLookup::where(['name' => $name])->count(); + if($coutn > 0) { - $station = StationLookup::whre(['name' => $name])->get(); + $station = StationLookup::where(['name' => $name])->get(); } else { return null; }