diff --git a/.env.dev.example b/.env.dev.example index e90110c7..11c325a5 100644 --- a/.env.dev.example +++ b/.env.dev.example @@ -1,6 +1,7 @@ APP_ENV=dev APP_KEY=base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI= APP_DEBUG=true +APP_LOCALE=en APP_LOG_LEVEL=debug APP_URL=http://localhost APP_SETTINGS_STORE=json diff --git a/app/Http/Controllers/Admin/SettingsController.php b/app/Http/Controllers/Admin/SettingsController.php index d664d09e..32019556 100644 --- a/app/Http/Controllers/Admin/SettingsController.php +++ b/app/Http/Controllers/Admin/SettingsController.php @@ -2,40 +2,40 @@ namespace App\Http\Controllers\Admin; -use App\Models\Setting; -use App\Http\Requests; - -use Redirect; -use Titan\Controllers\TitanAdminController; - use Illuminate\Http\Request; class SettingsController extends BaseController { - /** - * Display a listing of setting. - * - * @return Response - */ - public function index() - { - return $this->view('admins.settings.index')->with('items', Setting::all()); - } + /** + * Display a listing of setting. + * + * @return Response + */ + public function index() + { + $settings = array_filter(Setting::all(), function ($key) { + if (strpos($key, '_descrip') !== false) { return true; } + return false; + }); - /** - * Update the specified setting in storage. - * - * @param Setting $setting - * @param Request $request + return $this->view('admins.settings.index') + ->with('settings', $settings); + } + + /** + * Update the specified setting in storage. + * + * @param Setting $setting + * @param Request $request + * * @return Response */ public function update(Setting $setting, Request $request) - { - $this->validate($request, Setting::$rules, Setting::$messages); - + { + $this->validate($request, Setting::$rules, Setting::$messages); $this->updateEntry($setting, $request->all()); return redirect("/admin/settings"); - } + } } diff --git a/config/app.php b/config/app.php index 04657216..cb57d2c6 100755 --- a/config/app.php +++ b/config/app.php @@ -2,58 +2,19 @@ return [ - /* - | Application Name - */ - 'name' => 'phpvms', - - /* - | Application Environment - */ - 'env' => env('APP_ENV', 'dev'), - - /* - | Application Debug Mode - */ - 'debug' => env('APP_DEBUG', true), - - /* - | Application URL - */ - 'url' => env('APP_URL', 'http://localhost'), + 'version' => '2.0', - /* - |-------------------------------------------------------------------------- - | Application Timezone - |-------------------------------------------------------------------------- - | - | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. - | - */ - - 'timezone' => 'UTC', - 'locale' => 'en', + 'timezone' => env('APP_TIMEZONE', 'UTC'), + 'locale' => env('APP_LOCALE', 'en'), 'fallback_locale' => 'en', - /* - |-------------------------------------------------------------------------- - | Encryption Key - |-------------------------------------------------------------------------- - */ - 'key' => env('APP_KEY'), 'cipher' => 'AES-256-CBC', - /* - | Logging Configuration - */ - 'log' => env('APP_LOG', 'single'), 'log_level' => env('APP_LOG_LEVEL', 'debug'), diff --git a/config/phpvms.php b/config/phpvms.php index df9b26a6..cf3b3b2b 100644 --- a/config/phpvms.php +++ b/config/phpvms.php @@ -2,14 +2,10 @@ return [ - 'currencies' => [ - 'dollar', - 'euro', - 'gbp', - 'yen', - 'jpy', - 'rupee', - 'rouble', - ], + /** + * Pick one of: + * dollar, euro, gbp, yen, jpy, rupee, ruble + */ + 'currency' => 'dollar', ]; diff --git a/database/migrations/2015_08_25_172600_create_settings_table.php b/database/migrations/2015_08_25_172600_create_settings_table.php index c8ffee77..6208e967 100644 --- a/database/migrations/2015_08_25_172600_create_settings_table.php +++ b/database/migrations/2015_08_25_172600_create_settings_table.php @@ -7,40 +7,40 @@ use Illuminate\Support\Facades\Config; class CreateSettingsTable extends Migration { - public function __construct() - { + 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); + /** + * 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('timezone', 'UTC'); - Setting::set('currency', 'dollar'); - Setting::save(); - } + #Setting::set('currency', 'dollar'); + #Setting::set('currency_descrip', 'Currency to use'); - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop($this->tablename); - } + #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 6d8d4eba..c62881d8 100755 --- a/database/migrations/2017_06_08_0000_create_users_table.php +++ b/database/migrations/2017_06_08_0000_create_users_table.php @@ -27,6 +27,7 @@ class CreateUsersTable extends Migration $table->boolean('confirmed')->nullable(); $table->boolean('retired')->nullable(); $table->dateTime('last_pirep')->nullable(); + $table->integer('timezone')->default(0); $table->rememberToken(); $table->timestamps(); }); diff --git a/resources/views/admin/settings/table.blade.php b/resources/views/admin/settings/table.blade.php index 4a7766e5..eaa69fc6 100644 --- a/resources/views/admin/settings/table.blade.php +++ b/resources/views/admin/settings/table.blade.php @@ -2,12 +2,20 @@ Name Value + Description @foreach($settings as $s) {!! $s->key !!} {!! $s->value !!} + + @if(Setting::get($s->key.'_descrip')) + {!! Setting::get($s->key.'_descrip') !!} + @else +   + @endif + @endforeach