From 9a0858656433d354aa27468b0293efdc125946ca Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 22 Jul 2017 23:03:39 -0500 Subject: [PATCH] allow setting of IATA code for airline --- app/Http/Controllers/Admin/DashboardController.php | 2 +- app/Models/Airline.php | 1 + .../migrations/2017_06_08_191703_create_airlines_table.php | 4 ++++ resources/views/admin/airlines/fields.blade.php | 5 +++++ resources/views/admin/airlines/show_fields.blade.php | 5 +++++ resources/views/admin/airlines/table.blade.php | 2 ++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 5b954e3d..d893b385 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -13,7 +13,7 @@ class DashboardController extends BaseController */ public function index(Request $request) { - Feed::$cacheDir = storage_path(); + Feed::$cacheDir = storage_path('app'); Feed::$cacheExpire = '5 hours'; $feed = Feed::loadRss(config('phpvms.feed_url')); diff --git a/app/Models/Airline.php b/app/Models/Airline.php index b276efde..8dc8a3e7 100644 --- a/app/Models/Airline.php +++ b/app/Models/Airline.php @@ -16,6 +16,7 @@ class Airline extends Model public $fillable = [ 'code', + 'iata', 'name', 'fuel_100ll_cost', 'fuel_jeta_cost', diff --git a/database/migrations/2017_06_08_191703_create_airlines_table.php b/database/migrations/2017_06_08_191703_create_airlines_table.php index d304ca44..a9db9536 100644 --- a/database/migrations/2017_06_08_191703_create_airlines_table.php +++ b/database/migrations/2017_06_08_191703_create_airlines_table.php @@ -16,6 +16,7 @@ class CreateAirlinesTable extends Migration Schema::create('airlines', function (Blueprint $table) { $table->increments('id'); $table->string('code', 5); + $table->string('iata', 5); $table->string('name', 50); $table->string('country', 2)->nullable(); $table->boolean('active'); @@ -23,6 +24,9 @@ class CreateAirlinesTable extends Migration $table->index('code'); $table->unique('code'); + + $table->index('iata'); + $table->unique('iata'); }); } diff --git a/resources/views/admin/airlines/fields.blade.php b/resources/views/admin/airlines/fields.blade.php index 4d0ef5cf..43f8ff7b 100644 --- a/resources/views/admin/airlines/fields.blade.php +++ b/resources/views/admin/airlines/fields.blade.php @@ -4,6 +4,11 @@ {!! Form::text('code', null, ['class' => 'form-control']) !!} +
+ {!! Form::label('iata', 'IATA:') !!} + {!! Form::text('iata', null, ['class' => 'form-control']) !!} +
+
{!! Form::label('name', 'Name:') !!} diff --git a/resources/views/admin/airlines/show_fields.blade.php b/resources/views/admin/airlines/show_fields.blade.php index 0744a127..d9b88137 100644 --- a/resources/views/admin/airlines/show_fields.blade.php +++ b/resources/views/admin/airlines/show_fields.blade.php @@ -10,6 +10,11 @@

{!! $airlines->code !!}

+
+ {!! Form::label('iata', 'IATA:') !!} +

{!! $airlines->iata !!}

+
+
{!! Form::label('name', 'Name:') !!} diff --git a/resources/views/admin/airlines/table.blade.php b/resources/views/admin/airlines/table.blade.php index 76db1956..2c64b4eb 100644 --- a/resources/views/admin/airlines/table.blade.php +++ b/resources/views/admin/airlines/table.blade.php @@ -1,6 +1,7 @@ + @@ -9,6 +10,7 @@ @foreach($airlines as $al) +
CodeIATA Name Active Action
{!! $al->code !!}{!! $al->iata !!} {!! $al->name !!}