We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -8,92 +8,92 @@ |
||
| 8 | 8 | |
| 9 | 9 | class SettingsServiceProvider extends ServiceProvider |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Indicates if the loading of the provider is deferred. |
|
| 13 | - * |
|
| 14 | - * @var bool |
|
| 15 | - */ |
|
| 16 | - protected $defer = false; |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * Where the route file lives, both inside the package and in the app (if overwritten). |
|
| 20 | - * |
|
| 21 | - * @var string |
|
| 22 | - */ |
|
| 23 | - public $routeFilePath = '/routes/backpack/settings.php'; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Perform post-registration booting of services. |
|
| 27 | - * |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public function boot() |
|
| 31 | - { |
|
| 32 | - // use the vendor configuration file as fallback |
|
| 33 | - $this->mergeConfigFrom( |
|
| 34 | - __DIR__.'/config/backpack/settings.php', |
|
| 35 | - 'backpack.settings' |
|
| 36 | - ); |
|
| 37 | - |
|
| 38 | - // define the routes for the application |
|
| 39 | - $this->setupRoutes(); |
|
| 40 | - |
|
| 41 | - // only use the Settings package if the Settings table is present in the database |
|
| 42 | - if (! App::runningInConsole() && Schema::hasTable(config('backpack.settings.table_name'))) { |
|
| 43 | - /** @var \Illuminate\Database\Eloquent\Model $modelClass */ |
|
| 44 | - $modelClass = config('backpack.settings.model', \Backpack\Settings\app\Models\Setting::class); |
|
| 45 | - |
|
| 46 | - // get all settings from the database |
|
| 47 | - $settings = $modelClass::all(); |
|
| 48 | - |
|
| 49 | - $config_prefix = config('backpack.settings.config_prefix'); |
|
| 50 | - |
|
| 51 | - // bind all settings to the Laravel config, so you can call them like |
|
| 52 | - // Config::get('settings.contact_email') |
|
| 53 | - foreach ($settings as $key => $setting) { |
|
| 54 | - $prefixed_key = ! empty($config_prefix) ? $config_prefix.'.'.$setting->key : $setting->key; |
|
| 55 | - config([$prefixed_key => $setting->value]); |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - // publish the migrations and seeds |
|
| 59 | - $this->publishes([ |
|
| 60 | - __DIR__.'/database/migrations/create_settings_table.php.stub' => database_path('migrations/'.config('backpack.settings.migration_name').'.php'), |
|
| 61 | - ], 'migrations'); |
|
| 62 | - |
|
| 63 | - // publish translation files |
|
| 64 | - $this->publishes([__DIR__.'/resources/lang' => app()->langPath().'/vendor/backpack'], 'lang'); |
|
| 65 | - |
|
| 66 | - // publish setting files |
|
| 67 | - $this->publishes([__DIR__.'/config' => config_path()], 'config'); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Define the routes for the application. |
|
| 72 | - * |
|
| 73 | - * @return void |
|
| 74 | - */ |
|
| 75 | - public function setupRoutes() |
|
| 76 | - { |
|
| 77 | - // by default, use the routes file provided in the vendor |
|
| 78 | - $routeFilePathInUse = __DIR__.$this->routeFilePath; |
|
| 79 | - |
|
| 80 | - // but if there's a file with the same name in routes/backpack, use that one |
|
| 81 | - if (file_exists(base_path().$this->routeFilePath)) { |
|
| 82 | - $routeFilePathInUse = base_path().$this->routeFilePath; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - $this->loadRoutesFrom($routeFilePathInUse); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Register any package services. |
|
| 90 | - * |
|
| 91 | - * @return void |
|
| 92 | - */ |
|
| 93 | - public function register() |
|
| 94 | - { |
|
| 95 | - // register their aliases |
|
| 96 | - $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
|
| 97 | - $loader->alias('Setting', config('backpack.settings.model', \Backpack\Settings\app\Models\Setting::class)); |
|
| 98 | - } |
|
| 11 | + /** |
|
| 12 | + * Indicates if the loading of the provider is deferred. |
|
| 13 | + * |
|
| 14 | + * @var bool |
|
| 15 | + */ |
|
| 16 | + protected $defer = false; |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * Where the route file lives, both inside the package and in the app (if overwritten). |
|
| 20 | + * |
|
| 21 | + * @var string |
|
| 22 | + */ |
|
| 23 | + public $routeFilePath = '/routes/backpack/settings.php'; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Perform post-registration booting of services. |
|
| 27 | + * |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public function boot() |
|
| 31 | + { |
|
| 32 | + // use the vendor configuration file as fallback |
|
| 33 | + $this->mergeConfigFrom( |
|
| 34 | + __DIR__.'/config/backpack/settings.php', |
|
| 35 | + 'backpack.settings' |
|
| 36 | + ); |
|
| 37 | + |
|
| 38 | + // define the routes for the application |
|
| 39 | + $this->setupRoutes(); |
|
| 40 | + |
|
| 41 | + // only use the Settings package if the Settings table is present in the database |
|
| 42 | + if (! App::runningInConsole() && Schema::hasTable(config('backpack.settings.table_name'))) { |
|
| 43 | + /** @var \Illuminate\Database\Eloquent\Model $modelClass */ |
|
| 44 | + $modelClass = config('backpack.settings.model', \Backpack\Settings\app\Models\Setting::class); |
|
| 45 | + |
|
| 46 | + // get all settings from the database |
|
| 47 | + $settings = $modelClass::all(); |
|
| 48 | + |
|
| 49 | + $config_prefix = config('backpack.settings.config_prefix'); |
|
| 50 | + |
|
| 51 | + // bind all settings to the Laravel config, so you can call them like |
|
| 52 | + // Config::get('settings.contact_email') |
|
| 53 | + foreach ($settings as $key => $setting) { |
|
| 54 | + $prefixed_key = ! empty($config_prefix) ? $config_prefix.'.'.$setting->key : $setting->key; |
|
| 55 | + config([$prefixed_key => $setting->value]); |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + // publish the migrations and seeds |
|
| 59 | + $this->publishes([ |
|
| 60 | + __DIR__.'/database/migrations/create_settings_table.php.stub' => database_path('migrations/'.config('backpack.settings.migration_name').'.php'), |
|
| 61 | + ], 'migrations'); |
|
| 62 | + |
|
| 63 | + // publish translation files |
|
| 64 | + $this->publishes([__DIR__.'/resources/lang' => app()->langPath().'/vendor/backpack'], 'lang'); |
|
| 65 | + |
|
| 66 | + // publish setting files |
|
| 67 | + $this->publishes([__DIR__.'/config' => config_path()], 'config'); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Define the routes for the application. |
|
| 72 | + * |
|
| 73 | + * @return void |
|
| 74 | + */ |
|
| 75 | + public function setupRoutes() |
|
| 76 | + { |
|
| 77 | + // by default, use the routes file provided in the vendor |
|
| 78 | + $routeFilePathInUse = __DIR__.$this->routeFilePath; |
|
| 79 | + |
|
| 80 | + // but if there's a file with the same name in routes/backpack, use that one |
|
| 81 | + if (file_exists(base_path().$this->routeFilePath)) { |
|
| 82 | + $routeFilePathInUse = base_path().$this->routeFilePath; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + $this->loadRoutesFrom($routeFilePathInUse); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Register any package services. |
|
| 90 | + * |
|
| 91 | + * @return void |
|
| 92 | + */ |
|
| 93 | + public function register() |
|
| 94 | + { |
|
| 95 | + // register their aliases |
|
| 96 | + $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
|
| 97 | + $loader->alias('Setting', config('backpack.settings.model', \Backpack\Settings\app\Models\Setting::class)); |
|
| 98 | + } |
|
| 99 | 99 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $this->setupRoutes(); |
| 40 | 40 | |
| 41 | 41 | // only use the Settings package if the Settings table is present in the database |
| 42 | - if (! App::runningInConsole() && Schema::hasTable(config('backpack.settings.table_name'))) { |
|
| 42 | + if (!App::runningInConsole() && Schema::hasTable(config('backpack.settings.table_name'))) { |
|
| 43 | 43 | /** @var \Illuminate\Database\Eloquent\Model $modelClass */ |
| 44 | 44 | $modelClass = config('backpack.settings.model', \Backpack\Settings\app\Models\Setting::class); |
| 45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | // bind all settings to the Laravel config, so you can call them like |
| 52 | 52 | // Config::get('settings.contact_email') |
| 53 | 53 | foreach ($settings as $key => $setting) { |
| 54 | - $prefixed_key = ! empty($config_prefix) ? $config_prefix.'.'.$setting->key : $setting->key; |
|
| 54 | + $prefixed_key = !empty($config_prefix) ? $config_prefix.'.'.$setting->key : $setting->key; |
|
| 55 | 55 | config([$prefixed_key => $setting->value]); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -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 | } |