From 182cb2d33b825bef7ba4e00a0f319a5a7c02ca61 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Thu, 22 Mar 2018 23:11:59 -0500 Subject: [PATCH] Change flight_number field to uint --- .../migrations/2017_06_17_214650_create_flight_tables.php | 2 +- app/Services/ImportService.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Database/migrations/2017_06_17_214650_create_flight_tables.php b/app/Database/migrations/2017_06_17_214650_create_flight_tables.php index ed8c729d..dd77ae74 100644 --- a/app/Database/migrations/2017_06_17_214650_create_flight_tables.php +++ b/app/Database/migrations/2017_06_17_214650_create_flight_tables.php @@ -16,7 +16,7 @@ class CreateFlightTables extends Migration Schema::create('flights', function (Blueprint $table) { $table->string('id', \App\Interfaces\Model::ID_MAX_LENGTH); $table->unsignedInteger('airline_id'); - $table->string('flight_number', 10); + $table->unsignedInteger('flight_number'); $table->string('route_code', 5)->nullable(); $table->string('route_leg', 5)->nullable(); $table->string('dpt_airport_id', 5); diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index 587ea0eb..aaba1139 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -102,6 +102,11 @@ class ImportService extends Service continue; } + // turn it into a collection and run some filtering + $row = collect($row)->map(function ($val, $index) { + return trim($val); + })->toArray(); + $importer->import($row, $offset); }