diff --git a/.env.dev.example b/.env.dev.example index 0dd76f1c..2df16d21 100644 --- a/.env.dev.example +++ b/.env.dev.example @@ -3,7 +3,6 @@ APP_KEY=base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI= APP_DEBUG=true APP_LOCALE=en APP_URL=http://localhost -APP_SETTINGS_STORE=json APP_LOG=daily APP_LOG_LEVEL=debug diff --git a/.env.prod.example b/.env.prod.example index 2556b104..dceb6909 100644 --- a/.env.prod.example +++ b/.env.prod.example @@ -3,7 +3,6 @@ APP_KEY=base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI= APP_DEBUG=false APP_LOG_LEVEL=info APP_URL=http://localhost -APP_SETTINGS_STORE=json DB_CONNECTION=travis DB_HOST=127.0.0.1 diff --git a/.env.travis b/.env.travis index c176f40a..58b8fe1c 100644 --- a/.env.travis +++ b/.env.travis @@ -3,7 +3,6 @@ APP_KEY=base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost -APP_SETTINGS_STORE=json DB_CONNECTION=mysql DB_HOST=127.0.0.1 diff --git a/app/Http/Controllers/Admin/SettingsController.php b/app/Http/Controllers/Admin/SettingsController.php index 32019556..c9076e0c 100644 --- a/app/Http/Controllers/Admin/SettingsController.php +++ b/app/Http/Controllers/Admin/SettingsController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin; use Illuminate\Http\Request; +use Setting; class SettingsController extends BaseController { @@ -13,13 +14,15 @@ class SettingsController extends BaseController */ public function index() { - $settings = array_filter(Setting::all(), function ($key) { + /*$settings = array_filter(Setting::all(), function ($key) { if (strpos($key, '_descrip') !== false) { return true; } return false; - }); + });*/ + $settings = []; - return $this->view('admins.settings.index') - ->with('settings', $settings); + return view('admin.settings.index',[ + 'settings' => $settings, + ]); } /** @@ -32,8 +35,8 @@ class SettingsController extends BaseController */ public function update(Setting $setting, Request $request) { - $this->validate($request, Setting::$rules, Setting::$messages); - $this->updateEntry($setting, $request->all()); + $/*this->validate($request, Setting::$rules, Setting::$messages); + $this->updateEntry($setting, $request->all());*/ return redirect("/admin/settings"); } diff --git a/app/Models/Migrations/Migration.php b/app/Models/Migrations/Migration.php new file mode 100644 index 00000000..cc7fe4b0 --- /dev/null +++ b/app/Models/Migrations/Migration.php @@ -0,0 +1,31 @@ +insert($row); + } catch (Exception $e) { + # setting already exists + if ($e->getCode() === 23000) { + continue; + } + } + } + } +} diff --git a/app/Models/Pirep.php b/app/Models/Pirep.php index c6a29c48..5464beb6 100644 --- a/app/Models/Pirep.php +++ b/app/Models/Pirep.php @@ -21,40 +21,38 @@ class Pirep extends Model protected $dates = ['deleted_at']; - public $fillable - = [ - 'user_id', - 'flight_id', - 'flight_number', - 'route_code', - 'route_leg', - 'airline_id', - 'aircraft_id', - 'flight_time', - 'dpt_airport_id', - 'arr_airport_id', - 'fuel_used', - 'source', - 'level', - 'route', - 'notes', - 'status', - 'raw_data', - ]; + public $fillable = [ + 'user_id', + 'flight_id', + 'flight_number', + 'route_code', + 'route_leg', + 'airline_id', + 'aircraft_id', + 'flight_time', + 'dpt_airport_id', + 'arr_airport_id', + 'fuel_used', + 'source', + 'level', + 'route', + 'notes', + 'status', + 'raw_data', + ]; /** * The attributes that should be casted to native types. * * @var array */ - protected $casts - = [ - 'flight_time' => 'integer', - 'level' => 'integer', - 'fuel_used' => 'integer', - 'source' => 'integer', - 'status' => 'integer', - ]; + protected $casts = [ + 'flight_time' => 'integer', + 'level' => 'integer', + 'fuel_used' => 'integer', + 'source' => 'integer', + 'status' => 'integer', + ]; /** * Validation rules diff --git a/app/Models/Setting.php b/app/Models/Setting.php new file mode 100644 index 00000000..99c52871 --- /dev/null +++ b/app/Models/Setting.php @@ -0,0 +1,30 @@ + 'array', + ]; +} diff --git a/composer.json b/composer.json index edc3e4fa..a5c49c52 100755 --- a/composer.json +++ b/composer.json @@ -33,7 +33,6 @@ "symfony/dom-crawler": "v3.4.0", "league/geotools": "0.7.0", "toin0u/geotools-laravel": "^1.0", - "anlutro/l4-settings": "0.6.0", "webpatser/laravel-uuid": "3.0.1", "chrisbjr/api-guard": "4.1.0", "spatie/laravel-fractal": "5.3.0", @@ -47,7 +46,8 @@ "sebastiaanluca/laravel-helpers": "1.0.2", "tivie/php-os-detector": "1.1.0", "jackiedo/timezonelist": "^5.0", - "nesbot/carbon": "^1.22", + "nesbot/carbon": "1.22.*", + "pragmarx/version": "0.2.1", "tremby/laravel-git-version": "^1.1", "nabeel/laravel-installer": "dev-master", "nabeel/vacentral": "dev-master" diff --git a/composer.lock b/composer.lock index 7218fb47..35db76a5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,65 +4,8 @@ "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": "459233f5328b1d32bc905cdf05d8b523", + "content-hash": "beec22933bfc1504008682e0c932df55", "packages": [ - { - "name": "anlutro/l4-settings", - "version": "0.6.0", - "source": { - "type": "git", - "url": "https://github.com/anlutro/laravel-settings.git", - "reference": "48c9adb5c6c0736f7ace44c29c48759fc1163e0b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/anlutro/laravel-settings/zipball/48c9adb5c6c0736f7ace44c29c48759fc1163e0b", - "reference": "48c9adb5c6c0736f7ace44c29c48759fc1163e0b", - "shasum": "" - }, - "require": { - "illuminate/support": ">=4.1 <6.0", - "php": ">=5.3.0" - }, - "require-dev": { - "illuminate/database": ">=4.1 <6.0", - "illuminate/filesystem": ">=4.1 <6.0", - "mockery/mockery": "0.9.*", - "phpunit/phpunit": ">=4.8, <6" - }, - "suggest": { - "illuminate/database": "Save settings to a database table.", - "illuminate/filesystem": "Save settings to a JSON file." - }, - "type": "library", - "extra": { - "laravel": { - "aliases": { - "Setting": "anlutro\\LaravelSettings\\Facade" - }, - "providers": [ - "anlutro\\LaravelSettings\\ServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "anlutro\\LaravelSettings\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andreas Lutro", - "email": "anlutro@gmail.com" - } - ], - "description": "Persistent settings in Laravel.", - "time": "2017-11-08T18:16:13+00:00" - }, { "name": "chrisbjr/api-guard", "version": "4.1.0", @@ -3436,6 +3379,127 @@ ], "time": "2017-08-03T14:08:16+00:00" }, + { + "name": "pragmarx/version", + "version": "v0.2.1", + "source": { + "type": "git", + "url": "https://github.com/antonioribeiro/version.git", + "reference": "fd2eec365012f2f6e00a20f39e23e8efb8913ae9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/antonioribeiro/version/zipball/fd2eec365012f2f6e00a20f39e23e8efb8913ae9", + "reference": "fd2eec365012f2f6e00a20f39e23e8efb8913ae9", + "shasum": "" + }, + "require": { + "laravel/framework": "^5.5", + "php": "^7.0", + "pragmarx/yaml": "^0.1", + "symfony/process": "^3.3" + }, + "require-dev": { + "orchestra/testbench": "^3.5", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "component": "package", + "laravel": { + "providers": [ + "PragmaRX\\Version\\Package\\ServiceProvider" + ], + "aliases": { + "Version": "PragmaRX\\Version\\Package\\Facade" + } + } + }, + "autoload": { + "psr-4": { + "PragmaRX\\Version\\Package\\": "src/package", + "PragmaRX\\Version\\Tests\\": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Antonio Carlos Ribeiro", + "email": "acr@antoniocarlosribeiro.com", + "role": "Creator & Designer" + } + ], + "description": "Take control over your Laravel app version", + "keywords": [ + "laravel", + "version", + "versioning" + ], + "time": "2017-12-02T23:56:29+00:00" + }, + { + "name": "pragmarx/yaml", + "version": "v0.1.4", + "source": { + "type": "git", + "url": "https://github.com/antonioribeiro/yaml.git", + "reference": "b510623eb5008cc468e00a31259a3c860dd2b267" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/antonioribeiro/yaml/zipball/b510623eb5008cc468e00a31259a3c860dd2b267", + "reference": "b510623eb5008cc468e00a31259a3c860dd2b267", + "shasum": "" + }, + "require": { + "laravel/framework": "^5.5", + "php": "^7.0", + "symfony/yaml": "^3.3" + }, + "require-dev": { + "orchestra/testbench": "^3.5", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "component": "package", + "laravel": { + "providers": [ + "PragmaRX\\Yaml\\Package\\ServiceProvider" + ], + "aliases": { + "Yaml": "PragmaRX\\Yaml\\Package\\Facade" + } + } + }, + "autoload": { + "psr-4": { + "PragmaRX\\Yaml\\Package\\": "src/package", + "PragmaRX\\Yaml\\Tests\\": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Antonio Carlos Ribeiro", + "email": "acr@antoniocarlosribeiro.com", + "role": "Creator & Designer" + } + ], + "description": "Load your Laravel config files using yaml", + "keywords": [ + "config", + "laravel", + "yaml" + ], + "time": "2017-12-05T20:32:21+00:00" + }, { "name": "prettus/l5-repository", "version": "2.6.28", diff --git a/config/app.php b/config/app.php index a58d164a..5c8cf5b3 100755 --- a/config/app.php +++ b/config/app.php @@ -58,7 +58,6 @@ return [ InfyOm\Generator\InfyOmGeneratorServiceProvider::class, InfyOm\AdminLTETemplates\AdminLTETemplatesServiceProvider::class, Zizaco\Entrust\EntrustServiceProvider::class, - anlutro\LaravelSettings\ServiceProvider::class, Spatie\Fractal\FractalServiceProvider::class, SebastiaanLuca\Helpers\Methods\GlobalHelpersServiceProvider::class, SebastiaanLuca\Helpers\Collections\CollectionMacrosServiceProvider::class, diff --git a/config/phpvms.php b/config/phpvms.php index 2da4015a..e1c3c15b 100644 --- a/config/phpvms.php +++ b/config/phpvms.php @@ -16,25 +16,6 @@ return [ */ 'skin' => 'default', - /** - * Start date. Set the date of when your VA has started - * Used as an anchor point for some financials and things - * - * YYYY-MM-DD format - */ - 'start_date' => '2017-07-07', - - /** - * Pick one of: - * dollar, euro, gbp, yen, jpy, rupee, ruble - */ - 'currency' => 'dollar', - - /** - * Restrict showing flights from the user's current airport - */ - 'only_flights_from_current' => false, - /** * Your vaCentral API key */ diff --git a/database/migrations/2015_08_25_172600_create_settings_table.php b/database/migrations/2015_08_25_172600_create_settings_table.php deleted file mode 100644 index 6208e967..00000000 --- a/database/migrations/2015_08_25_172600_create_settings_table.php +++ /dev/null @@ -1,46 +0,0 @@ -tablename = Config::get('settings.table'); - $this->keyColumn = Config::get('settings.keyColumn'); - $this->valueColumn = Config::get('settings.valueColumn'); - } - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create($this->tablename, function (Blueprint $table) { - $table->increments('id'); - $table->string($this->keyColumn)->index(); - $table->text($this->valueColumn); - $table->timestamps(); - }); - - #Setting::set('currency', 'dollar'); - #Setting::set('currency_descrip', 'Currency to use'); - - #Setting::save(); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop($this->tablename); - } -} 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 f5a84f8e..b47c7c80 100755 --- a/database/migrations/2017_06_08_0000_create_users_table.php +++ b/database/migrations/2017_06_08_0000_create_users_table.php @@ -1,8 +1,8 @@ 1, + 'name' => 'admin', + 'display_name' => 'Administrators', + ], + [ + 'id' => 2, + 'name' => 'user', + 'display_name' => 'Pilot' + ], + ]; + + $this->addData('roles', $roles); } /** diff --git a/database/migrations/2017_12_10_014930_create_settings_table.php b/database/migrations/2017_12_10_014930_create_settings_table.php new file mode 100644 index 00000000..b7de5d51 --- /dev/null +++ b/database/migrations/2017_12_10_014930_create_settings_table.php @@ -0,0 +1,84 @@ +increments('id'); + $table->integer('order')->default(1); + $table->string('name')->default(''); + $table->string('key'); + $table->string('value'); + $table->string('group')->default('general'); + $table->text('type')->default('text'); + $table->text('options')->nullable(); + $table->text('description')->nullable(); + $table->timestamps(); + $table->unique('key'); + }); + + /** + * Initial default settings + */ + $settings = [ + [ + 'order' => 1, + 'name' => 'Start Date', + 'group' => '', + 'key' => 'general.start_date', + 'value' => '', + 'type' => 'date', + 'description' => 'The date your VA started', + ], + [ + 'order' => 2, + 'name' => 'Currency to Use', + 'group' => 'general', + 'key' => 'general.currency', + 'value' => 'dollar', + 'type' => 'text', + 'options' => 'dollar,euro,gbp,yen,jpy,rupee,ruble', + 'description' => 'Currency to show in the interface', + ], + [ + 'order' => 10, + 'name' => 'Flights from Current', + 'group' => 'flights', + 'key' => 'flights.only_flights_from_current', + 'value' => 'true', + 'type' => 'boolean', + 'description' => 'Only allow flights from current location', + ], + [ + 'order' => 20, + 'name' => 'Hide Inactive Pilots', + 'group' => 'pilots', + 'key' => 'pilots.hide_inactive', + 'value' => 'true', + 'type' => 'boolean', + 'description' => 'Don\'t show inactive pilots in the public view', + ], + ]; + + $this->addData('settings', $settings); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop($this->tablename); + } +} diff --git a/database/seeds/dev.yml b/database/seeds/dev.yml index f7acc2cc..b0e325d0 100644 --- a/database/seeds/dev.yml +++ b/database/seeds/dev.yml @@ -1,12 +1,4 @@ # -roles: - - id: 1 - name: admin - display_name: Administrators - - id: 2 - name: user - display_name: Pilot - users: - id: 1 name: Admin User diff --git a/database/seeds/prod.yml b/database/seeds/prod.yml index 226a8ed6..0f8b907f 100644 --- a/database/seeds/prod.yml +++ b/database/seeds/prod.yml @@ -3,14 +3,6 @@ # want to modify or erase any of this here # -roles: - - id: 1 - name: admin - display_name: Administrators - - id: 2 - name: user - display_name: Pilot - ranks: - id: 1 name: New Pilot diff --git a/resources/views/admin/menu.blade.php b/resources/views/admin/menu.blade.php index 2a17db8c..145a3590 100644 --- a/resources/views/admin/menu.blade.php +++ b/resources/views/admin/menu.blade.php @@ -35,6 +35,7 @@ class="pe-7s-map-marker">airports