We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -7,49 +7,49 @@ |
||
| 7 | 7 | |
| 8 | 8 | class SettingCrudController extends CrudController |
| 9 | 9 | { |
| 10 | - use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation; |
|
| 11 | - use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation; |
|
| 12 | - |
|
| 13 | - public function setup() |
|
| 14 | - { |
|
| 15 | - CRUD::setModel(config('backpack.settings.model',\Backpack\Settings\app\Models\Setting::class)); |
|
| 16 | - CRUD::setEntityNameStrings(trans('backpack::settings.setting_singular'), trans('backpack::settings.setting_plural')); |
|
| 17 | - CRUD::setRoute(backpack_url(config('backpack.settings.route'))); |
|
| 18 | - } |
|
| 19 | - |
|
| 20 | - public function setupListOperation() |
|
| 21 | - { |
|
| 22 | - // only show settings which are marked as active |
|
| 23 | - CRUD::addClause('where', 'active', 1); |
|
| 24 | - |
|
| 25 | - // columns to show in the table view |
|
| 26 | - CRUD::setColumns([ |
|
| 27 | - [ |
|
| 28 | - 'name' => 'name', |
|
| 29 | - 'label' => trans('backpack::settings.name'), |
|
| 30 | - ], |
|
| 31 | - [ |
|
| 32 | - 'name' => 'value', |
|
| 33 | - 'label' => trans('backpack::settings.value'), |
|
| 34 | - ], |
|
| 35 | - [ |
|
| 36 | - 'name' => 'description', |
|
| 37 | - 'label' => trans('backpack::settings.description'), |
|
| 38 | - ], |
|
| 39 | - ]); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - public function setupUpdateOperation() |
|
| 43 | - { |
|
| 44 | - CRUD::addField([ |
|
| 45 | - 'name' => 'name', |
|
| 46 | - 'label' => trans('backpack::settings.name'), |
|
| 47 | - 'type' => 'text', |
|
| 48 | - 'attributes' => [ |
|
| 49 | - 'disabled' => 'disabled', |
|
| 50 | - ], |
|
| 51 | - ]); |
|
| 52 | - |
|
| 53 | - CRUD::addField(json_decode(CRUD::getCurrentEntry()->field, true)); |
|
| 54 | - } |
|
| 10 | + use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation; |
|
| 11 | + use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation; |
|
| 12 | + |
|
| 13 | + public function setup() |
|
| 14 | + { |
|
| 15 | + CRUD::setModel(config('backpack.settings.model',\Backpack\Settings\app\Models\Setting::class)); |
|
| 16 | + CRUD::setEntityNameStrings(trans('backpack::settings.setting_singular'), trans('backpack::settings.setting_plural')); |
|
| 17 | + CRUD::setRoute(backpack_url(config('backpack.settings.route'))); |
|
| 18 | + } |
|
| 19 | + |
|
| 20 | + public function setupListOperation() |
|
| 21 | + { |
|
| 22 | + // only show settings which are marked as active |
|
| 23 | + CRUD::addClause('where', 'active', 1); |
|
| 24 | + |
|
| 25 | + // columns to show in the table view |
|
| 26 | + CRUD::setColumns([ |
|
| 27 | + [ |
|
| 28 | + 'name' => 'name', |
|
| 29 | + 'label' => trans('backpack::settings.name'), |
|
| 30 | + ], |
|
| 31 | + [ |
|
| 32 | + 'name' => 'value', |
|
| 33 | + 'label' => trans('backpack::settings.value'), |
|
| 34 | + ], |
|
| 35 | + [ |
|
| 36 | + 'name' => 'description', |
|
| 37 | + 'label' => trans('backpack::settings.description'), |
|
| 38 | + ], |
|
| 39 | + ]); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + public function setupUpdateOperation() |
|
| 43 | + { |
|
| 44 | + CRUD::addField([ |
|
| 45 | + 'name' => 'name', |
|
| 46 | + 'label' => trans('backpack::settings.name'), |
|
| 47 | + 'type' => 'text', |
|
| 48 | + 'attributes' => [ |
|
| 49 | + 'disabled' => 'disabled', |
|
| 50 | + ], |
|
| 51 | + ]); |
|
| 52 | + |
|
| 53 | + CRUD::addField(json_decode(CRUD::getCurrentEntry()->field, true)); |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function setup() |
| 14 | 14 | { |
| 15 | - CRUD::setModel(config('backpack.settings.model',\Backpack\Settings\app\Models\Setting::class)); |
|
| 15 | + CRUD::setModel(config('backpack.settings.model', \Backpack\Settings\app\Models\Setting::class)); |
|
| 16 | 16 | CRUD::setEntityNameStrings(trans('backpack::settings.setting_singular'), trans('backpack::settings.setting_plural')); |
| 17 | 17 | CRUD::setRoute(backpack_url(config('backpack.settings.route'))); |
| 18 | 18 | } |
@@ -9,94 +9,94 @@ |
||
| 9 | 9 | |
| 10 | 10 | class SettingsServiceProvider extends ServiceProvider |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * Indicates if loading of the provider is deferred. |
|
| 14 | - * |
|
| 15 | - * @var bool |
|
| 16 | - */ |
|
| 17 | - protected $defer = false; |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Where the route file lives, both inside the package and in the app (if overwritten). |
|
| 21 | - * |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - public $routeFilePath = '/routes/backpack/settings.php'; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Perform post-registration booting of services. |
|
| 28 | - * |
|
| 29 | - * @return void |
|
| 30 | - */ |
|
| 31 | - public function boot() |
|
| 32 | - { |
|
| 33 | - // use the vendor configuration file as fallback |
|
| 34 | - $this->mergeConfigFrom( |
|
| 35 | - __DIR__.'/config/backpack/settings.php', |
|
| 36 | - 'backpack.settings' |
|
| 37 | - ); |
|
| 38 | - |
|
| 39 | - // define the routes for the application |
|
| 40 | - $this->setupRoutes($this->app->router); |
|
| 41 | - |
|
| 42 | - // only use the Settings package if the Settings table is present in the database |
|
| 43 | - if (!\App::runningInConsole() && Schema::hasTable(config('backpack.settings.table_name'))) { |
|
| 44 | - //get the model class from configuration |
|
| 45 | - $modelClass = \Config::get('backpack.settings.model', \Backpack\Settings\app\Models\Setting::class); |
|
| 46 | - |
|
| 47 | - // get all settings from the database |
|
| 48 | - $settings = $modelClass::all(); |
|
| 49 | - |
|
| 50 | - $config_prefix = config('backpack.settings.config_prefix'); |
|
| 51 | - |
|
| 52 | - // bind all settings to the Laravel config, so you can call them like |
|
| 53 | - // Config::get('settings.contact_email') |
|
| 54 | - foreach ($settings as $key => $setting) { |
|
| 55 | - $prefixed_key = !empty($config_prefix) ? $config_prefix.'.'.$setting->key : $setting->key; |
|
| 56 | - Config::set($prefixed_key, $setting->value); |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - // publish the migrations and seeds |
|
| 60 | - $this->publishes([ |
|
| 61 | - __DIR__.'/database/migrations/create_settings_table.php.stub' => database_path('migrations/'.config('backpack.settings.migration_name').'.php'), |
|
| 62 | - ], 'migrations'); |
|
| 63 | - |
|
| 64 | - // publish translation files |
|
| 65 | - $this->publishes([__DIR__.'/resources/lang' => app()->langPath().'/vendor/backpack'], 'lang'); |
|
| 66 | - |
|
| 67 | - // publish setting files |
|
| 68 | - $this->publishes([__DIR__.'/config' => config_path()], 'config'); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Define the routes for the application. |
|
| 73 | - * |
|
| 74 | - * @param \Illuminate\Routing\Router $router |
|
| 75 | - * |
|
| 76 | - * @return void |
|
| 77 | - */ |
|
| 78 | - public function setupRoutes(Router $router) |
|
| 79 | - { |
|
| 80 | - // by default, use the routes file provided in vendor |
|
| 81 | - $routeFilePathInUse = __DIR__.$this->routeFilePath; |
|
| 82 | - |
|
| 83 | - // but if there's a file with the same name in routes/backpack, use that one |
|
| 84 | - if (file_exists(base_path().$this->routeFilePath)) { |
|
| 85 | - $routeFilePathInUse = base_path().$this->routeFilePath; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $this->loadRoutesFrom($routeFilePathInUse); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Register any package services. |
|
| 93 | - * |
|
| 94 | - * @return void |
|
| 95 | - */ |
|
| 96 | - public function register() |
|
| 97 | - { |
|
| 98 | - // register their aliases |
|
| 99 | - $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
|
| 100 | - $loader->alias('Setting', \Backpack\Settings\app\Models\Setting::class); |
|
| 101 | - } |
|
| 12 | + /** |
|
| 13 | + * Indicates if loading of the provider is deferred. |
|
| 14 | + * |
|
| 15 | + * @var bool |
|
| 16 | + */ |
|
| 17 | + protected $defer = false; |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Where the route file lives, both inside the package and in the app (if overwritten). |
|
| 21 | + * |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + public $routeFilePath = '/routes/backpack/settings.php'; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Perform post-registration booting of services. |
|
| 28 | + * |
|
| 29 | + * @return void |
|
| 30 | + */ |
|
| 31 | + public function boot() |
|
| 32 | + { |
|
| 33 | + // use the vendor configuration file as fallback |
|
| 34 | + $this->mergeConfigFrom( |
|
| 35 | + __DIR__.'/config/backpack/settings.php', |
|
| 36 | + 'backpack.settings' |
|
| 37 | + ); |
|
| 38 | + |
|
| 39 | + // define the routes for the application |
|
| 40 | + $this->setupRoutes($this->app->router); |
|
| 41 | + |
|
| 42 | + // only use the Settings package if the Settings table is present in the database |
|
| 43 | + if (!\App::runningInConsole() && Schema::hasTable(config('backpack.settings.table_name'))) { |
|
| 44 | + //get the model class from configuration |
|
| 45 | + $modelClass = \Config::get('backpack.settings.model', \Backpack\Settings\app\Models\Setting::class); |
|
| 46 | + |
|
| 47 | + // get all settings from the database |
|
| 48 | + $settings = $modelClass::all(); |
|
| 49 | + |
|
| 50 | + $config_prefix = config('backpack.settings.config_prefix'); |
|
| 51 | + |
|
| 52 | + // bind all settings to the Laravel config, so you can call them like |
|
| 53 | + // Config::get('settings.contact_email') |
|
| 54 | + foreach ($settings as $key => $setting) { |
|
| 55 | + $prefixed_key = !empty($config_prefix) ? $config_prefix.'.'.$setting->key : $setting->key; |
|
| 56 | + Config::set($prefixed_key, $setting->value); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + // publish the migrations and seeds |
|
| 60 | + $this->publishes([ |
|
| 61 | + __DIR__.'/database/migrations/create_settings_table.php.stub' => database_path('migrations/'.config('backpack.settings.migration_name').'.php'), |
|
| 62 | + ], 'migrations'); |
|
| 63 | + |
|
| 64 | + // publish translation files |
|
| 65 | + $this->publishes([__DIR__.'/resources/lang' => app()->langPath().'/vendor/backpack'], 'lang'); |
|
| 66 | + |
|
| 67 | + // publish setting files |
|
| 68 | + $this->publishes([__DIR__.'/config' => config_path()], 'config'); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Define the routes for the application. |
|
| 73 | + * |
|
| 74 | + * @param \Illuminate\Routing\Router $router |
|
| 75 | + * |
|
| 76 | + * @return void |
|
| 77 | + */ |
|
| 78 | + public function setupRoutes(Router $router) |
|
| 79 | + { |
|
| 80 | + // by default, use the routes file provided in vendor |
|
| 81 | + $routeFilePathInUse = __DIR__.$this->routeFilePath; |
|
| 82 | + |
|
| 83 | + // but if there's a file with the same name in routes/backpack, use that one |
|
| 84 | + if (file_exists(base_path().$this->routeFilePath)) { |
|
| 85 | + $routeFilePathInUse = base_path().$this->routeFilePath; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $this->loadRoutesFrom($routeFilePathInUse); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Register any package services. |
|
| 93 | + * |
|
| 94 | + * @return void |
|
| 95 | + */ |
|
| 96 | + public function register() |
|
| 97 | + { |
|
| 98 | + // register their aliases |
|
| 99 | + $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
|
| 100 | + $loader->alias('Setting', \Backpack\Settings\app\Models\Setting::class); |
|
| 101 | + } |
|
| 102 | 102 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | 4 | |
| 5 | - /* |
|
| 5 | + /* |
|
| 6 | 6 | |-------------------------------------------------------------------------- |
| 7 | 7 | | Table Name |
| 8 | 8 | |-------------------------------------------------------------------------- |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | | Database Settings Table Name |
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | - 'table_name' => 'settings', |
|
| 13 | + 'table_name' => 'settings', |
|
| 14 | 14 | |
| 15 | - /* |
|
| 15 | + /* |
|
| 16 | 16 | |-------------------------------------------------------------------------- |
| 17 | 17 | | Model Name |
| 18 | 18 | |-------------------------------------------------------------------------- |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | | Settings Eloquent Model Class |
| 21 | 21 | | |
| 22 | 22 | */ |
| 23 | - 'model' => \Backpack\Settings\app\Models\Setting::class, |
|
| 23 | + 'model' => \Backpack\Settings\app\Models\Setting::class, |
|
| 24 | 24 | |
| 25 | - /* |
|
| 25 | + /* |
|
| 26 | 26 | |-------------------------------------------------------------------------- |
| 27 | 27 | | Route |
| 28 | 28 | |-------------------------------------------------------------------------- |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | | URL Segment aka route to the Settings panel. |
| 31 | 31 | | |
| 32 | 32 | */ |
| 33 | - 'route' => 'setting', |
|
| 33 | + 'route' => 'setting', |
|
| 34 | 34 | |
| 35 | - /* |
|
| 35 | + /* |
|
| 36 | 36 | |-------------------------------------------------------------------------- |
| 37 | 37 | | Config Prefix |
| 38 | 38 | |-------------------------------------------------------------------------- |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | | - if you leave this empty and your keys match other configuration files you might overwrite them. |
| 46 | 46 | | |
| 47 | 47 | */ |
| 48 | - 'config_prefix' => 'settings', |
|
| 48 | + 'config_prefix' => 'settings', |
|
| 49 | 49 | |
| 50 | - /* |
|
| 50 | + /* |
|
| 51 | 51 | |-------------------------------------------------------------------------- |
| 52 | 52 | | Migration file name |
| 53 | 53 | |-------------------------------------------------------------------------- |
@@ -56,5 +56,5 @@ discard block |
||
| 56 | 56 | | Note: .php extension is automatically added. |
| 57 | 57 | | |
| 58 | 58 | */ |
| 59 | - 'migration_name' => '2015_08_04_131614_create_settings_table', |
|
| 59 | + 'migration_name' => '2015_08_04_131614_create_settings_table', |
|
| 60 | 60 | ]; |