diff --git a/app/Http/Controllers/Admin/AirportController.php b/app/Http/Controllers/Admin/AirportController.php index a8e81190..f0d2250a 100644 --- a/app/Http/Controllers/Admin/AirportController.php +++ b/app/Http/Controllers/Admin/AirportController.php @@ -7,6 +7,7 @@ use App\Http\Requests\UpdateAirportRequest; use App\Repositories\AirportRepository; use Illuminate\Http\Request; use Flash; +use Jackiedo\Timezonelist\Facades\Timezonelist; use Prettus\Repository\Criteria\RequestCriteria; use Response; @@ -96,6 +97,7 @@ class AirportController extends BaseController } return view('admin.airports.edit', [ + 'timezones' => Timezonelist::toArray(), 'airport' => $airport, ]); } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index eb7745d7..6f3bff85 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -10,6 +10,7 @@ use Hash; use Illuminate\Http\Request; use Illuminate\Foundation\Http\FormRequest; use Flash; +use Jackiedo\Timezonelist\Facades\Timezonelist; use Prettus\Repository\Criteria\RequestCriteria; use Response; @@ -118,6 +119,7 @@ class UserController extends BaseController return view('admin.users.edit', [ 'user' => $user, + 'timezones' => Timezonelist::toArray(), 'airports' => Airport::all()->pluck('icao', 'id'), 'airlines' => Airline::all()->pluck('name', 'id'), 'ranks' => Rank::all()->pluck('name', 'id'), diff --git a/app/Models/Airport.php b/app/Models/Airport.php index 429322d9..98f5944e 100644 --- a/app/Models/Airport.php +++ b/app/Models/Airport.php @@ -12,6 +12,7 @@ class Airport extends Model { public $table = 'airports'; public $timestamps = false; + public $incrementing = false; public $fillable = [ 'id', @@ -20,11 +21,15 @@ class Airport extends Model 'location', 'lat', 'lon', + 'timezone', 'fuel_100ll_cost', 'fuel_jeta_cost', 'fuel_mogas_cost', ]; + protected $casts = [ + 'id' => 'string', + ]; /** * Validation rules * diff --git a/app/Models/User.php b/app/Models/User.php index 97dea264..cceb8f8a 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -64,6 +64,7 @@ class User extends Authenticatable 'home_airport_id', 'curr_airport_id', 'rank_id', + 'timezone', 'active', ]; diff --git a/composer.json b/composer.json index dd553702..415747ef 100755 --- a/composer.json +++ b/composer.json @@ -46,7 +46,9 @@ "nwidart/laravel-modules": "2.6.0", "sebastiaanluca/laravel-helpers": "1.0.2", "nabeel/laravel-installer": "dev-master", - "tivie/php-os-detector": "1.1.0" + "tivie/php-os-detector": "1.1.0", + "jackiedo/timezonelist": "^5.0", + "nesbot/carbon": "^1.22" }, "require-dev": { "phpunit/phpunit": "6.4.0", diff --git a/composer.lock b/composer.lock index c646a1a8..8ee661c0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "df8634a2bf7eeab2eab737e82bd163bb", + "content-hash": "f2bce1dffa47efbd492ce598ca910d39", "packages": [ { "name": "anlutro/l4-settings", @@ -50,7 +50,7 @@ "anlutro\\LaravelSettings\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -92,7 +92,7 @@ "Chrisbjr\\ApiGuard\\": "src" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "authors": [ { "name": "Chris Bautista", @@ -536,7 +536,7 @@ "Doctrine\\DBAL\\": "lib/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -859,7 +859,7 @@ "Egulias\\EmailValidator\\": "EmailValidator" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -966,7 +966,7 @@ "Parsedown": "" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -1020,7 +1020,7 @@ "Hashids\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -1127,7 +1127,7 @@ "InfyOm\\AdminLTETemplates\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -1146,7 +1146,7 @@ "laravel", "templates" ], - "time": "2017-11-25 04:43:54" + "time": "2017-11-25T04:43:54+00:00" }, { "name": "infyomlabs/laravel-generator", @@ -1188,7 +1188,7 @@ "src/helpers.php" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -1212,7 +1212,50 @@ "test", "view" ], - "time": "2017-11-25 05:18:22" + "time": "2017-11-25T05:18:22+00:00" + }, + { + "name": "jackiedo/timezonelist", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/JackieDo/Timezone-List.git", + "reference": "e7bdd089209840dadaef5ab32574f1b5abd16ae3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JackieDo/Timezone-List/zipball/e7bdd089209840dadaef5ab32574f1b5abd16ae3", + "reference": "e7bdd089209840dadaef5ab32574f1b5abd16ae3", + "shasum": "" + }, + "require": { + "illuminate/support": "5.*", + "php": ">=5.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Jackiedo\\Timezonelist\\": "src/Jackiedo/Timezonelist" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jackie Do", + "email": "anhvudo@gmail.com" + } + ], + "description": "A small package use to create a timezone list box in Laravel", + "keywords": [ + "laravel", + "timezone", + "timezonelist", + "timezones" + ], + "time": "2017-05-16T04:31:37+00:00" }, { "name": "jeremeamia/SuperClosure", @@ -1441,7 +1484,7 @@ "Illuminate\\": "src/Illuminate/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -1864,7 +1907,7 @@ } ], "description": "Bloom filter implementation", - "time": "2017-11-30 17:51:14" + "time": "2017-11-30T17:51:14+00:00" }, { "name": "monolog/monolog", @@ -1970,7 +2013,7 @@ "Cron\\": "src/Cron/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2019,7 +2062,7 @@ "src/DeepCopy/deep_copy.php" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2066,7 +2109,7 @@ "src/Helpers/functions.php" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2081,7 +2124,7 @@ } ], "description": "Laravel web installer", - "time": "2017-12-04 19:05:57" + "time": "2017-12-04T19:05:57+00:00" }, { "name": "nesbot/carbon", @@ -2171,7 +2214,7 @@ "PhpParser\\": "lib/PhpParser" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], @@ -2604,7 +2647,7 @@ ] } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2757,7 +2800,7 @@ "Prophecy\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2875,7 +2918,7 @@ "src/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], @@ -3016,7 +3059,7 @@ "src/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], @@ -3097,7 +3140,7 @@ "src/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], @@ -3220,7 +3263,7 @@ "Prettus\\Repository\\": "src/Prettus/Repository/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -3823,7 +3866,7 @@ "src/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], @@ -4398,7 +4441,7 @@ "src/helpers.php" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -4581,7 +4624,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -4690,7 +4733,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -4858,7 +4901,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -4912,7 +4955,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5000,7 +5043,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5201,7 +5244,7 @@ "bootstrap.php" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5258,7 +5301,7 @@ "bootstrap.php" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5317,7 +5360,7 @@ "Resources/stubs" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5369,7 +5412,7 @@ "Symfony\\Polyfill\\Util\\": "" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5424,7 +5467,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5481,7 +5524,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5564,7 +5607,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5648,7 +5691,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5716,7 +5759,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5781,7 +5824,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -5974,7 +6017,7 @@ "Tivie\\OS\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "APACHE 2.0" ], @@ -6195,7 +6238,7 @@ "Webpatser\\Uuid": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -6324,7 +6367,7 @@ "src/helper.php" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -6381,7 +6424,7 @@ "Zend\\Diactoros\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-2-Clause" ], @@ -6460,7 +6503,7 @@ "permission", "roles" ], - "time": "2016-12-29 06:25:06" + "time": "2016-12-29T06:25:06+00:00" } ], "packages-dev": [ @@ -6675,7 +6718,7 @@ "Whoops\\": "src/Whoops/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -7067,7 +7110,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], diff --git a/config/app.php b/config/app.php index 206f58dd..19e2d576 100755 --- a/config/app.php +++ b/config/app.php @@ -63,6 +63,7 @@ return [ SebastiaanLuca\Helpers\Methods\GlobalHelpersServiceProvider::class, SebastiaanLuca\Helpers\Collections\CollectionMacrosServiceProvider::class, Toin0u\Geotools\GeotoolsServiceProvider::class, + //Jackiedo\Timezonelist\TimezonelistServiceProvider::class, /* * Application Service Providers... diff --git a/database/migrations/2017_06_08_0000_create_users_table.php b/database/migrations/2017_06_08_0000_create_users_table.php index d1041948..f5a84f8e 100755 --- a/database/migrations/2017_06_08_0000_create_users_table.php +++ b/database/migrations/2017_06_08_0000_create_users_table.php @@ -26,7 +26,7 @@ class CreateUsersTable extends Migration $table->bigInteger('flights')->unsigned()->default(0); $table->bigInteger('flight_time')->unsigned()->default(0); $table->decimal('balance', 19, 2)->nullable(); - $table->tinyInteger('timezone')->default(0); + $table->string('timezone', 64)->nullable(); $table->boolean('active')->nullable(); $table->rememberToken(); $table->timestamps(); diff --git a/database/migrations/2017_06_11_135707_create_airports_table.php b/database/migrations/2017_06_11_135707_create_airports_table.php index 12787016..a02a9f2b 100644 --- a/database/migrations/2017_06_11_135707_create_airports_table.php +++ b/database/migrations/2017_06_11_135707_create_airports_table.php @@ -20,6 +20,7 @@ class CreateAirportsTable extends Migration $table->string('name', 50); $table->string('location', 50)->nullable(); $table->string('country', 50)->nullable(); + $table->string('timezone', 64)->nullable(); $table->double('fuel_100ll_cost', 19, 2)->default(0); $table->double('fuel_jeta_cost', 19, 2)->default(0); $table->double('fuel_mogas_cost', 19, 2)->default(0); diff --git a/database/seeds/dev.yml b/database/seeds/dev.yml index 6bd48642..763966ea 100644 --- a/database/seeds/dev.yml +++ b/database/seeds/dev.yml @@ -94,18 +94,21 @@ airports: location: Austin, Texas, USA lat: 30.1945278 lon: -97.6698889 + timezone: America/Chicago - id: KJFK icao: KJFK name: John F Kennedy location: New York, New York, USA lat: 40.6399257 lon: -73.7786950 + timezone: America/New_York - id: EGLL icao: EGLL name: London Heathrow location: London, England lat: 51.4775 lon: -0.4614 + timezone: Europe/London # aircraft: diff --git a/resources/views/admin/airports/fields.blade.php b/resources/views/admin/airports/fields.blade.php index 3b04bb67..1c1d04c2 100644 --- a/resources/views/admin/airports/fields.blade.php +++ b/resources/views/admin/airports/fields.blade.php @@ -25,6 +25,11 @@ {!! Form::number('lon', null, ['class' => 'form-control', 'step' => '0.000001']) !!} +