#12 #16 settings service and timezone/currency setting

This commit is contained in:
Nabeel Shahzad 2017-06-20 15:03:51 -05:00
parent 85610aeec6
commit 7d92c68870
8 changed files with 766 additions and 603 deletions

View File

@ -50,7 +50,6 @@ class FlightController extends BaseController
{
$this->flightRepository->pushCriteria(new RequestCriteria($request));
$flights = $this->flightRepository->all();
return view('admin.flights.index')
->with('flights', $flights);
}

View File

@ -19,7 +19,8 @@
"spatie/laravel-pjax": "^1.3",
"symfony/yaml": "^3.3",
"league/geotools": "@stable",
"toin0u/geotools-laravel": "^1.0"
"toin0u/geotools-laravel": "^1.0",
"anlutro/l4-settings": "^0.5.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",

1248
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -96,6 +96,7 @@ return [
InfyOm\Generator\InfyOmGeneratorServiceProvider::class,
InfyOm\AdminLTETemplates\AdminLTETemplatesServiceProvider::class,
Zizaco\Entrust\EntrustServiceProvider::class,
anlutro\LaravelSettings\ServiceProvider::class,
/*
* Application Service Providers...
@ -148,6 +149,7 @@ return [
'Flash' => Laracasts\Flash\Flash::class,
'Yaml' => Symfony\Component\Yaml\Yaml::class,
'Geotools' => Toin0u\Geotools\Facade\Geotools::class,
'Setting' => 'anlutro\LaravelSettings\Facade',
],
];

47
config/phpvms.php Normal file
View File

@ -0,0 +1,47 @@
<?php
return [
'currencies' => [
'dollar',
'euro',
'gbp',
'yen',
'jpy',
'rupee',
'rouble',
],
'timezones' => [
'-12' => '(GMT -12:00) Eniwetok, Kwajalein',
'-11' => '(GMT -11:00) Midway Island, Samoa',
'-10' => '(GMT -10:00) Hawaii',
'-9' => '(GMT -9:00) Alaska',
'-8' => '(GMT -8:00) Pacific Time (US &amp; Canada)',
'-7' => '(GMT -7:00) Mountain Time (US &amp; Canada)',
'-6' => '(GMT -6:00) Central Time (US &amp; Canada), Mexico City',
'-5' => '(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima',
'-4' => '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz',
'-3.5' => '(GMT -3:30) Newfoundland',
'-3' => '(GMT -3:00) Brazil, Buenos Aires, Georgetown',
'-2' => '(GMT -2:00) Mid-Atlantic',
'-1' => '(GMT -1:00) Azores, Cape Verde Islands',
'0' => '(GMT) Western Europe Time, London, Lisbon, Casablanca',
'1' => '(GMT +1:00) Brussels, Copenhagen, Madrid, Paris',
'2' => '(GMT +2:00) Kaliningrad, South Africa',
'3' => '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg',
'3.5' => '(GMT +3:30) Tehran',
'4' => '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi',
'4.5' => '(GMT +4:30) Kabul',
'5' => '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent',
'5.5' => '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi',
'6' => '(GMT +6:00) Almaty, Dhaka, Colombo',
'7' => '(GMT +7:00) Bangkok, Hanoi, Jakarta',
'8' => '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong',
'9' => '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk',
'9.5' => '(GMT +9:30) Adelaide, Darwin',
'10' => '(GMT +10:00) Eastern Australia, Guam, Vladivostok',
'11' => '(GMT +11:00) Magadan, Solomon Islands, New Caledonia',
'12' => '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka'
),
];

22
config/settings.php Normal file
View File

@ -0,0 +1,22 @@
<?php
return array(
// which type of store to use.
// valid options: 'json', 'database'
'store' => 'json',
// if the json store is used, give the full path to the .json file
// that the store writes to.
'path' => storage_path().'/settings.json',
// if the database store is used, set the name of the table used..
'table' => 'settings',
// If the database store is used, you can set which connection to use. if
// set to null, the default connection will be used.
'connection' => null,
// If you want to use custom column names in database store you could
// set them in this configuration
'keyColumn' => 'key',
'valueColumn' => 'value'
);

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Config;
class CreateSettingsTable extends Migration
{
public function __construct()
{
$this->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);
});
Setting::set('timezone', '0');
Setting::set('currency', 'dollar');
Setting::save();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop($this->tablename);
}
}

1
storage/settings.json Normal file
View File

@ -0,0 +1 @@
{"foo":"bar"}