diff --git a/.gitignore b/.gitignore index 35a7317c..c5363902 100644 --- a/.gitignore +++ b/.gitignore @@ -30,8 +30,6 @@ tmp/ .idea/**/workspace.xml .idea/**/tasks.xml .idea/dictionaries - -# Sensitive or high-churn files: .idea/**/dataSources/ .idea/**/dataSources.ids .idea/**/dataSources.xml @@ -39,12 +37,23 @@ tmp/ .idea/**/sqlDataSources.xml .idea/**/dynamic.xml .idea/**/uiDesigner.xml +.idea/**/gradle.xml +.idea/**/libraries +cmake-build-debug/ +.idea/**/mongoSettings.xml +*.iws +out/ +.idea_modules/ +atlassian-ide-plugin.xml +.idea/replstate.xml +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties phpvms_next.iml # Gradle: -.idea/**/gradle.xml -.idea/**/libraries public/info.php local.conf.php diff --git a/Makefile b/Makefile index 958fa486..2979ff33 100644 --- a/Makefile +++ b/Makefile @@ -10,13 +10,13 @@ all: install .PHONY: clean clean: - @find bootstrap/cache -type f -not -name '.gitignore' -print0 | xargs -0 -r rm -- - @find storage/app/public -type f -not -name '.gitignore' -print0 | xargs -0 -r rm -- - @find storage/app -type f -not -name '.gitignore' -not -name public -print0 | xargs -0 -r rm -- - @find storage/framework/cache -type f -not -name '.gitignore' -print0 | xargs -0 -r rm -- - @find storage/framework/sessions -type f -not -name '.gitignore' -print0 | xargs -0 -r rm -- - @find storage/framework/views -type f -not -name '.gitignore' -print0 | xargs -0 -r rm -- - @find storage/logs -type f -not -name '.gitignore' -print0 | xargs -0 -r rm -- + @find bootstrap/cache -type f -not -name '.gitignore' -print0 -delete + @find storage/app/public -type f -not -name '.gitignore' -print0 -delete + @find storage/app -type f -not -name '.gitignore' -not -name public -print0 -delete + @find storage/framework/cache -type f -not -name '.gitignore' -print0 -delete + @find storage/framework/sessions -type f -not -name '.gitignore' -print0 -delete + @find storage/framework/views -type f -not -name '.gitignore' -print0 -delete + @find storage/logs -type f -not -name '.gitignore' -print0 -delete @php artisan route:clear @php artisan config:clear @@ -32,7 +32,7 @@ install: build @echo "Done!" .PHONY: update -update: clean build +update: build @php artisan migrate @echo "Done!" @@ -40,7 +40,7 @@ update: clean build reset: clean @php artisan database:create --reset @php artisan migrate:refresh --seed - @make install + @make update .PHONY: tests tests: test diff --git a/app/Http/Controllers/Admin/AirportController.php b/app/Http/Controllers/Admin/AirportController.php index f0d2250a..037f1463 100644 --- a/app/Http/Controllers/Admin/AirportController.php +++ b/app/Http/Controllers/Admin/AirportController.php @@ -27,6 +27,7 @@ class AirportController extends BaseController * * @param Request $request * @return Response + * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function index(Request $request) { @@ -46,13 +47,16 @@ class AirportController extends BaseController */ public function create() { - return view('admin.airports.create'); + return view('admin.airports.create', [ + 'timezones' => Timezonelist::toArray(), + ]); } /** * Store a newly created Airport in storage. * @param CreateAirportRequest $request * @return Response + * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function store(CreateAirportRequest $request) { @@ -104,9 +108,10 @@ class AirportController extends BaseController /** * Update the specified Airport in storage. - * @param int $id + * @param int $id * @param UpdateAirportRequest $request * @return Response + * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function update($id, UpdateAirportRequest $request) { diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 773b289e..9c68ff72 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -23,7 +23,7 @@ class DashboardController extends BaseController /*Feed::$cacheDir = storage_path('app'); Feed::$cacheExpire = '5 hours'; - $feed = Feed::loadRss(config('phpvms.feed_url'));*/ + $feed = Feed::loadRss(config('phpvms.news_feed_url'));*/ $feed = []; return view('admin.dashboard.index', [ 'feed' => $feed, diff --git a/app/Http/Controllers/Api/AirportController.php b/app/Http/Controllers/Api/AirportController.php new file mode 100644 index 00000000..228cfdb5 --- /dev/null +++ b/app/Http/Controllers/Api/AirportController.php @@ -0,0 +1,31 @@ +airportRepo = $airportRepo; + } + + /** + * Do a lookup, via vaCentral, for the airport information + * @param $id + * @return AirportResource + */ + public function lookup($id) + { + $airport = AirportLookup::get($id); + return new AirportResource(collect($airport)); + } +} diff --git a/app/Http/Resources/Airport.php b/app/Http/Resources/Airport.php new file mode 100644 index 00000000..32b8a932 --- /dev/null +++ b/app/Http/Resources/Airport.php @@ -0,0 +1,19 @@ +app['config']->get('phpvms', []); $this->app['config']->set( 'phpvms', diff --git a/composer.json b/composer.json index e43f487b..edc3e4fa 100755 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "keywords": ["phpvms", "virtual", "airlines"], "license": "MIT", "type": "project", - "minimum-stability": "stable", + "prefer-stable": true, "url": "https://github.com/nabeelio/phpvms.git", "require": { "php": ">=7.0", @@ -45,11 +45,12 @@ "scriptfusion/phpunit-immediate-exception-printer": "1.3.0", "nwidart/laravel-modules": "2.6.0", "sebastiaanluca/laravel-helpers": "1.0.2", - "nabeel/laravel-installer": "dev-master", "tivie/php-os-detector": "1.1.0", "jackiedo/timezonelist": "^5.0", "nesbot/carbon": "^1.22", - "tremby/laravel-git-version": "^1.1" + "tremby/laravel-git-version": "^1.1", + "nabeel/laravel-installer": "dev-master", + "nabeel/vacentral": "dev-master" }, "require-dev": { "phpunit/phpunit": "6.4.0", diff --git a/composer.lock b/composer.lock index 627c5580..7218fb47 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": "2f361a73a9d21108cf1e05a2bbfb1626", + "content-hash": "459233f5328b1d32bc905cdf05d8b523", "packages": [ { "name": "anlutro/l4-settings", @@ -985,6 +985,187 @@ ], "time": "2017-11-14T20:44:03+00:00" }, + { + "name": "guzzlehttp/guzzle", + "version": "6.3.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0 || ^5.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2017-06-22T18:50:49+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20T17:10:46+00:00" + }, { "name": "hashids/hashids", "version": "2.0.4", @@ -2126,6 +2307,42 @@ "description": "Laravel web installer", "time": "2017-12-04T19:05:57+00:00" }, + { + "name": "nabeel/vacentral", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nabeelio/vacentral-library.git", + "reference": "79093ce128b791755a787a420d344b8adb05e8a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nabeelio/vacentral-library/zipball/79093ce128b791755a787a420d344b8adb05e8a4", + "reference": "79093ce128b791755a787a420d344b8adb05e8a4", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "6.3.0", + "php": ">= 7.0.0", + "symfony/lts": "v3" + }, + "require-dev": { + "doctrine/instantiator": "v1.0.5", + "phpunit/phpunit": "5.7.25", + "phpunit/phpunit-mock-objects": "3.4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "VaCentral\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "time": "2017-12-07T20:57:37+00:00" + }, { "name": "nesbot/carbon", "version": "1.22.1", @@ -7172,9 +7389,10 @@ "infyomlabs/adminlte-templates": 20, "zizaco/entrust": 20, "makinacorpus/php-bloom": 20, - "nabeel/laravel-installer": 20 + "nabeel/laravel-installer": 20, + "nabeel/vacentral": 20 }, - "prefer-stable": false, + "prefer-stable": true, "prefer-lowest": false, "platform": { "php": ">=7.0" diff --git a/config/app.php b/config/app.php index 19e2d576..a58d164a 100755 --- a/config/app.php +++ b/config/app.php @@ -63,7 +63,7 @@ return [ SebastiaanLuca\Helpers\Methods\GlobalHelpersServiceProvider::class, SebastiaanLuca\Helpers\Collections\CollectionMacrosServiceProvider::class, Toin0u\Geotools\GeotoolsServiceProvider::class, - //Jackiedo\Timezonelist\TimezonelistServiceProvider::class, + Jackiedo\Timezonelist\TimezonelistServiceProvider::class, /* * Application Service Providers... diff --git a/config/phpvms.php b/config/phpvms.php index 4f4d5953..2da4015a 100644 --- a/config/phpvms.php +++ b/config/phpvms.php @@ -35,8 +35,18 @@ return [ */ 'only_flights_from_current' => false, + /** + * Your vaCentral API key + */ + 'vacentral_api_key' => '', + + /** + * vaCentral API URL. You likely don't need to change this + */ + 'vacentral_api_url' => 'https://api.vacentral.net', + /** * Misc Settings */ - 'feed_url' => 'http://forum.phpvms.net/rss/1-announcements-feed.xml/?', + 'news_feed_url' => 'http://forum.phpvms.net/rss/1-announcements-feed.xml/?', ]; 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 19fd6e91..19ac565a 100644 --- a/database/migrations/2017_06_11_135707_create_airports_table.php +++ b/database/migrations/2017_06_11_135707_create_airports_table.php @@ -21,7 +21,7 @@ class CreateAirportsTable extends Migration $table->string('name', 100); $table->string('location', 100)->nullable(); $table->string('country', 48)->nullable(); - $table->string('timezone', 64)->nullable(); + $table->string('tz', 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 ff6db454..f7acc2cc 100644 --- a/database/seeds/dev.yml +++ b/database/seeds/dev.yml @@ -95,7 +95,7 @@ airports: location: Austin, Texas, USA lat: 30.1945278 lon: -97.6698889 - timezone: America/Chicago + tz: America/Chicago - id: KJFK iata: JFK icao: KJFK @@ -103,7 +103,7 @@ airports: location: New York, New York, USA lat: 40.6399257 lon: -73.7786950 - timezone: America/New_York + tz: America/New_York - id: EGLL iata: LHR icao: EGLL @@ -111,7 +111,7 @@ airports: location: London, England lat: 51.4775 lon: -0.4614 - timezone: Europe/London + tz: Europe/London # aircraft: diff --git a/public/js/admin/admin.js b/public/js/admin/admin.js index 568179fc..7610b567 100644 --- a/public/js/admin/admin.js +++ b/public/js/admin/admin.js @@ -2,7 +2,18 @@ * admin functions, mostly map/mapping related */ -function phpvms_render_airspace_map(opts) { +function phpvms_vacentral_airport_lookup(icao, callback) +{ + $.ajax({ + url: '/api/airports/' + icao + '/lookup', + method: 'GET' + }).done(function (data, status) { + callback(data.data); + }); +} + +function phpvms_render_airspace_map(opts) +{ opts = __parse_opts(opts); var map = __draw_base_map(opts); if(opts.set_marker == true) { L.marker(coords).addTo(map); } @@ -13,7 +24,7 @@ function __parse_opts(opts) { _.defaults(opts, { render_elem: 'map', overlay_elem: '', - lat: 0, + lat: 0, lon: 0, zoom: 12, layers: [], @@ -24,7 +35,7 @@ function __parse_opts(opts) { } function __draw_base_map(opts) { - + var coords = [opts.lat, opts.lon]; /*var openaip_airspace_labels = new L.TileLayer.WMS( diff --git a/resources/views/admin/airports/create.blade.php b/resources/views/admin/airports/create.blade.php index 9218675c..7c0c3b0f 100644 --- a/resources/views/admin/airports/create.blade.php +++ b/resources/views/admin/airports/create.blade.php @@ -1,12 +1,13 @@ @extends('admin.app') -@section('title', "Add Airport") +@section('title', 'Add Airport') @section('content')