We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -11,81 +11,81 @@ |
||
| 11 | 11 | |
| 12 | 12 | class SettingsServiceProvider extends ServiceProvider |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * Indicates if loading of the provider is deferred. |
|
| 16 | - * |
|
| 17 | - * @var bool |
|
| 18 | - */ |
|
| 19 | - protected $defer = false; |
|
| 14 | + /** |
|
| 15 | + * Indicates if loading of the provider is deferred. |
|
| 16 | + * |
|
| 17 | + * @var bool |
|
| 18 | + */ |
|
| 19 | + protected $defer = false; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Perform post-registration booting of services. |
|
| 23 | - * |
|
| 24 | - * @return void |
|
| 25 | - */ |
|
| 26 | - public function boot() |
|
| 27 | - { |
|
| 28 | - // only use the Settings package if the Settings table is present in the database |
|
| 29 | - if (count(Schema::getColumnListing('settings'))) { |
|
| 30 | - // get all settings from the database |
|
| 31 | - $settings = Setting::all(); |
|
| 21 | + /** |
|
| 22 | + * Perform post-registration booting of services. |
|
| 23 | + * |
|
| 24 | + * @return void |
|
| 25 | + */ |
|
| 26 | + public function boot() |
|
| 27 | + { |
|
| 28 | + // only use the Settings package if the Settings table is present in the database |
|
| 29 | + if (count(Schema::getColumnListing('settings'))) { |
|
| 30 | + // get all settings from the database |
|
| 31 | + $settings = Setting::all(); |
|
| 32 | 32 | |
| 33 | - // bind all settings to the Laravel config, so you can call them like |
|
| 34 | - // Config::get('settings.contact_email') |
|
| 35 | - foreach ($settings as $key => $setting) { |
|
| 36 | - Config::set('settings.'.$setting->key, $setting->value); |
|
| 37 | - } |
|
| 38 | - } |
|
| 33 | + // bind all settings to the Laravel config, so you can call them like |
|
| 34 | + // Config::get('settings.contact_email') |
|
| 35 | + foreach ($settings as $key => $setting) { |
|
| 36 | + Config::set('settings.'.$setting->key, $setting->value); |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - $this->loadTranslationsFrom(realpath(__DIR__.'/resources/lang'), 'backpack'); |
|
| 40 | + $this->loadTranslationsFrom(realpath(__DIR__.'/resources/lang'), 'backpack'); |
|
| 41 | 41 | |
| 42 | - // publish the migrations and seeds |
|
| 43 | - $this->publishes([__DIR__.'/database/migrations/' => database_path('migrations')], 'migrations'); |
|
| 44 | - $this->publishes([__DIR__.'/database/seeds/' => database_path('seeds')], 'seeds'); |
|
| 42 | + // publish the migrations and seeds |
|
| 43 | + $this->publishes([__DIR__.'/database/migrations/' => database_path('migrations')], 'migrations'); |
|
| 44 | + $this->publishes([__DIR__.'/database/seeds/' => database_path('seeds')], 'seeds'); |
|
| 45 | 45 | |
| 46 | - // publish translation files |
|
| 47 | - $this->publishes([__DIR__.'/resources/lang' => resource_path('lang/vendor/backpack')], 'lang'); |
|
| 48 | - } |
|
| 46 | + // publish translation files |
|
| 47 | + $this->publishes([__DIR__.'/resources/lang' => resource_path('lang/vendor/backpack')], 'lang'); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Define the routes for the application. |
|
| 52 | - * |
|
| 53 | - * @param \Illuminate\Routing\Router $router |
|
| 54 | - * |
|
| 55 | - * @return void |
|
| 56 | - */ |
|
| 57 | - public function setupRoutes(Router $router) |
|
| 58 | - { |
|
| 59 | - $router->group(['namespace' => 'Backpack\Settings\app\Http\Controllers'], function ($router) { |
|
| 60 | - // Admin Interface Routes |
|
| 61 | - Route::group(['prefix' => config('backpack.base.route_prefix', 'admin'), |
|
| 62 | - 'middleware' => ['web', 'admin'], ], function () { |
|
| 63 | - // Settings |
|
| 64 | - Route::resource('setting', 'SettingCrudController'); |
|
| 65 | - }); |
|
| 66 | - }); |
|
| 67 | - } |
|
| 50 | + /** |
|
| 51 | + * Define the routes for the application. |
|
| 52 | + * |
|
| 53 | + * @param \Illuminate\Routing\Router $router |
|
| 54 | + * |
|
| 55 | + * @return void |
|
| 56 | + */ |
|
| 57 | + public function setupRoutes(Router $router) |
|
| 58 | + { |
|
| 59 | + $router->group(['namespace' => 'Backpack\Settings\app\Http\Controllers'], function ($router) { |
|
| 60 | + // Admin Interface Routes |
|
| 61 | + Route::group(['prefix' => config('backpack.base.route_prefix', 'admin'), |
|
| 62 | + 'middleware' => ['web', 'admin'], ], function () { |
|
| 63 | + // Settings |
|
| 64 | + Route::resource('setting', 'SettingCrudController'); |
|
| 65 | + }); |
|
| 66 | + }); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Register any package services. |
|
| 71 | - * |
|
| 72 | - * @return void |
|
| 73 | - */ |
|
| 74 | - public function register() |
|
| 75 | - { |
|
| 76 | - $this->registerSettings(); |
|
| 77 | - $this->setupRoutes($this->app->router); |
|
| 69 | + /** |
|
| 70 | + * Register any package services. |
|
| 71 | + * |
|
| 72 | + * @return void |
|
| 73 | + */ |
|
| 74 | + public function register() |
|
| 75 | + { |
|
| 76 | + $this->registerSettings(); |
|
| 77 | + $this->setupRoutes($this->app->router); |
|
| 78 | 78 | |
| 79 | - // use this if your package has a config file |
|
| 80 | - // config([ |
|
| 81 | - // 'config/Settings.php', |
|
| 82 | - // ]); |
|
| 83 | - } |
|
| 79 | + // use this if your package has a config file |
|
| 80 | + // config([ |
|
| 81 | + // 'config/Settings.php', |
|
| 82 | + // ]); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - private function registerSettings() |
|
| 86 | - { |
|
| 87 | - $this->app->bind('settings', function ($app) { |
|
| 88 | - return new Settings($app); |
|
| 89 | - }); |
|
| 90 | - } |
|
| 85 | + private function registerSettings() |
|
| 86 | + { |
|
| 87 | + $this->app->bind('settings', function ($app) { |
|
| 88 | + return new Settings($app); |
|
| 89 | + }); |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -9,89 +9,89 @@ |
||
| 9 | 9 | |
| 10 | 10 | class SettingCrudController extends CrudController |
| 11 | 11 | { |
| 12 | - public function __construct() |
|
| 13 | - { |
|
| 14 | - parent::__construct(); |
|
| 12 | + public function __construct() |
|
| 13 | + { |
|
| 14 | + parent::__construct(); |
|
| 15 | 15 | |
| 16 | - $this->crud->setModel("Backpack\Settings\app\Models\Setting"); |
|
| 17 | - $this->crud->setEntityNameStrings(trans('backpack::settings.setting_singular'), trans('backpack::settings.setting_plural')); |
|
| 18 | - $this->crud->setRoute(config('backpack.base.route_prefix', 'admin').'/setting'); |
|
| 19 | - $this->crud->denyAccess(['create', 'delete']); |
|
| 20 | - $this->crud->setColumns([ |
|
| 21 | - [ |
|
| 22 | - 'name' => 'name', |
|
| 23 | - 'label' => trans('backpack::settings.name'), |
|
| 24 | - ], |
|
| 25 | - [ |
|
| 26 | - 'name' => 'value', |
|
| 27 | - 'label' => trans('backpack::settings.value'), |
|
| 28 | - ], |
|
| 29 | - [ |
|
| 30 | - 'name' => 'description', |
|
| 31 | - 'label' => trans('backpack::settings.description'), |
|
| 32 | - ], |
|
| 33 | - ]); |
|
| 34 | - $this->crud->addField([ |
|
| 35 | - 'name' => 'name', |
|
| 36 | - 'label' => trans('backpack::settings.name'), |
|
| 37 | - 'type' => 'text', |
|
| 38 | - 'attributes' => [ |
|
| 39 | - 'disabled' => 'disabled', |
|
| 40 | - ], |
|
| 41 | - ]); |
|
| 42 | - } |
|
| 16 | + $this->crud->setModel("Backpack\Settings\app\Models\Setting"); |
|
| 17 | + $this->crud->setEntityNameStrings(trans('backpack::settings.setting_singular'), trans('backpack::settings.setting_plural')); |
|
| 18 | + $this->crud->setRoute(config('backpack.base.route_prefix', 'admin').'/setting'); |
|
| 19 | + $this->crud->denyAccess(['create', 'delete']); |
|
| 20 | + $this->crud->setColumns([ |
|
| 21 | + [ |
|
| 22 | + 'name' => 'name', |
|
| 23 | + 'label' => trans('backpack::settings.name'), |
|
| 24 | + ], |
|
| 25 | + [ |
|
| 26 | + 'name' => 'value', |
|
| 27 | + 'label' => trans('backpack::settings.value'), |
|
| 28 | + ], |
|
| 29 | + [ |
|
| 30 | + 'name' => 'description', |
|
| 31 | + 'label' => trans('backpack::settings.description'), |
|
| 32 | + ], |
|
| 33 | + ]); |
|
| 34 | + $this->crud->addField([ |
|
| 35 | + 'name' => 'name', |
|
| 36 | + 'label' => trans('backpack::settings.name'), |
|
| 37 | + 'type' => 'text', |
|
| 38 | + 'attributes' => [ |
|
| 39 | + 'disabled' => 'disabled', |
|
| 40 | + ], |
|
| 41 | + ]); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Display all rows in the database for this entity. |
|
| 46 | - * This overwrites the default CrudController behaviour: |
|
| 47 | - * - instead of showing all entries, only show the "active" ones. |
|
| 48 | - * |
|
| 49 | - * @return Response |
|
| 50 | - */ |
|
| 51 | - public function index() |
|
| 52 | - { |
|
| 53 | - // if view_table_permission is false, abort |
|
| 54 | - $this->crud->hasAccessOrFail('list'); |
|
| 55 | - $this->crud->addClause('where', 'active', 1); // <---- this is where it's different from CrudController::index() |
|
| 44 | + /** |
|
| 45 | + * Display all rows in the database for this entity. |
|
| 46 | + * This overwrites the default CrudController behaviour: |
|
| 47 | + * - instead of showing all entries, only show the "active" ones. |
|
| 48 | + * |
|
| 49 | + * @return Response |
|
| 50 | + */ |
|
| 51 | + public function index() |
|
| 52 | + { |
|
| 53 | + // if view_table_permission is false, abort |
|
| 54 | + $this->crud->hasAccessOrFail('list'); |
|
| 55 | + $this->crud->addClause('where', 'active', 1); // <---- this is where it's different from CrudController::index() |
|
| 56 | 56 | |
| 57 | - $this->data['entries'] = $this->crud->getEntries(); |
|
| 58 | - $this->data['crud'] = $this->crud; |
|
| 59 | - $this->data['title'] = ucfirst($this->crud->entity_name_plural); |
|
| 57 | + $this->data['entries'] = $this->crud->getEntries(); |
|
| 58 | + $this->data['crud'] = $this->crud; |
|
| 59 | + $this->data['title'] = ucfirst($this->crud->entity_name_plural); |
|
| 60 | 60 | |
| 61 | - // load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package |
|
| 62 | - return view('crud::list', $this->data); |
|
| 63 | - } |
|
| 61 | + // load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package |
|
| 62 | + return view('crud::list', $this->data); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - public function store(StoreRequest $request) |
|
| 66 | - { |
|
| 67 | - return parent::storeCrud(); |
|
| 68 | - } |
|
| 65 | + public function store(StoreRequest $request) |
|
| 66 | + { |
|
| 67 | + return parent::storeCrud(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Show the form for editing the specified resource. |
|
| 72 | - * |
|
| 73 | - * @param int $id |
|
| 74 | - * |
|
| 75 | - * @return Response |
|
| 76 | - */ |
|
| 77 | - public function edit($id) |
|
| 78 | - { |
|
| 79 | - $this->crud->hasAccessOrFail('update'); |
|
| 70 | + /** |
|
| 71 | + * Show the form for editing the specified resource. |
|
| 72 | + * |
|
| 73 | + * @param int $id |
|
| 74 | + * |
|
| 75 | + * @return Response |
|
| 76 | + */ |
|
| 77 | + public function edit($id) |
|
| 78 | + { |
|
| 79 | + $this->crud->hasAccessOrFail('update'); |
|
| 80 | 80 | |
| 81 | - $this->data['entry'] = $this->crud->getEntry($id); |
|
| 82 | - $this->crud->addField((array) json_decode($this->data['entry']->field)); // <---- this is where it's different |
|
| 83 | - $this->data['crud'] = $this->crud; |
|
| 84 | - $this->data['fields'] = $this->crud->getUpdateFields($id); |
|
| 85 | - $this->data['title'] = trans('backpack::crud.edit').' '.$this->crud->entity_name; |
|
| 81 | + $this->data['entry'] = $this->crud->getEntry($id); |
|
| 82 | + $this->crud->addField((array) json_decode($this->data['entry']->field)); // <---- this is where it's different |
|
| 83 | + $this->data['crud'] = $this->crud; |
|
| 84 | + $this->data['fields'] = $this->crud->getUpdateFields($id); |
|
| 85 | + $this->data['title'] = trans('backpack::crud.edit').' '.$this->crud->entity_name; |
|
| 86 | 86 | |
| 87 | - $this->data['id'] = $id; |
|
| 87 | + $this->data['id'] = $id; |
|
| 88 | 88 | |
| 89 | - // load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package |
|
| 90 | - return view('crud::edit', $this->data); |
|
| 91 | - } |
|
| 89 | + // load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package |
|
| 90 | + return view('crud::edit', $this->data); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - public function update(UpdateRequest $request) |
|
| 94 | - { |
|
| 95 | - return parent::updateCrud(); |
|
| 96 | - } |
|
| 93 | + public function update(UpdateRequest $request) |
|
| 94 | + { |
|
| 95 | + return parent::updateCrud(); |
|
| 96 | + } |
|
| 97 | 97 | } |