From 12993962337f26fadaf459ef4d3c530b373dc58a Mon Sep 17 00:00:00 2001 From: Skintillion Date: Thu, 23 Apr 2020 03:35:14 -0700 Subject: [PATCH 01/16] Add route names to route --- src/routes/web.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/web.php b/src/routes/web.php index d1c3b7d..65d8ec7 100644 --- a/src/routes/web.php +++ b/src/routes/web.php @@ -3,6 +3,6 @@ Route::group([ 'middleware' => array_merge(['web'], config('app_settings.middleware', [])) ], function () { - Route::get(config('app_settings.url'), config('app_settings.controller').'@index'); - Route::post(config('app_settings.url'), config('app_settings.controller').'@store'); + Route::get(config('app_settings.url'), config('app_settings.controller').'@index')->name(config('app_settings.route_names.index')); + Route::post(config('app_settings.url'), config('app_settings.controller').'@store')->name(config('app_settings.route_names.store')); }); From 524ac06512d8cc9f7d135a0eb2823fe22817c2c5 Mon Sep 17 00:00:00 2001 From: Skintillion Date: Thu, 23 Apr 2020 03:35:59 -0700 Subject: [PATCH 02/16] Add route name options to config --- src/config/app_settings.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/config/app_settings.php b/src/config/app_settings.php index 2f354be..b33bc81 100644 --- a/src/config/app_settings.php +++ b/src/config/app_settings.php @@ -64,6 +64,12 @@ // Any middleware you want to run on above route 'middleware' => [], + // Route Names + 'route_names' => [ + 'index' => 'settings.index', + 'store' => 'settings.store', + ], + // View settings 'setting_page_view' => 'app_settings::settings_page', 'flash_partial' => 'app_settings::_flash', From 462da84aab77afb08ab78c715124e0cf1f5995dc Mon Sep 17 00:00:00 2001 From: "AndreaMauro@Home" Date: Wed, 11 Nov 2020 00:40:28 +0100 Subject: [PATCH 03/16] changed private to protected attributes and functions --- src/Setting/AppSettings.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Setting/AppSettings.php b/src/Setting/AppSettings.php index c6fe655..92caf7f 100644 --- a/src/Setting/AppSettings.php +++ b/src/Setting/AppSettings.php @@ -13,7 +13,7 @@ class AppSettings /** * @var SettingStorage */ - private $settingStorage; + protected $settingStorage; /** * AppSettings constructor. @@ -214,7 +214,7 @@ public function getValidationRules() * @param bool $out * @return bool|int|mixed|string */ - private function castValue($dataType, $value, $out = false) + protected function castValue($dataType, $value, $out = false) { switch ($dataType) { case 'array': @@ -285,7 +285,7 @@ protected function cleanUpSettings($allDefinedSettings) * @param $out * @return array|mixed|string */ - private function castToArray($value, $out) + protected function castToArray($value, $out) { if ($out) { return empty($value) ? [] : json_decode($value, true); @@ -301,7 +301,7 @@ private function castToArray($value, $out) * @param $request Request * @return string|null */ - private function uploadFile($setting, $request) + protected function uploadFile($setting, $request) { $settingName = Arr::get($setting, 'name'); @@ -337,7 +337,7 @@ private function uploadFile($setting, $request) * @param $oldFile * @param $disk */ - private function deleteFile($oldFile, $disk): void + protected function deleteFile($oldFile, $disk): void { if ($oldFile && Storage::disk($disk)->exists($oldFile)) { Storage::disk($disk)->delete($oldFile); From 940d8ec02d209113fbeeeb8e1326921ce234f936 Mon Sep 17 00:00:00 2001 From: "AndreaMauro@Home" Date: Wed, 11 Nov 2020 01:13:58 +0100 Subject: [PATCH 04/16] no message --- src/Setting/AppSettings.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Setting/AppSettings.php b/src/Setting/AppSettings.php index 92caf7f..d87071b 100644 --- a/src/Setting/AppSettings.php +++ b/src/Setting/AppSettings.php @@ -21,6 +21,16 @@ class AppSettings * @param SettingStorage $settingStorage */ public function __construct(SettingStorage $settingStorage) + { + $this->setSettingStorage($settingStorage); + } + + /** + * Sets the settings storage. + * + * @param SettingStorage $settingStorage + */ + public function setSettingStorage(SettingStorage $settingStorage) { $groupName = $this->getSettingsGroupName(); From b85045049e48283efc7d52217581efb3be305104 Mon Sep 17 00:00:00 2001 From: "AndreaMauro@Home" Date: Wed, 11 Nov 2020 02:24:53 +0100 Subject: [PATCH 05/16] added function to change storage group --- src/Setting/AppSettings.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Setting/AppSettings.php b/src/Setting/AppSettings.php index d87071b..c4db79e 100644 --- a/src/Setting/AppSettings.php +++ b/src/Setting/AppSettings.php @@ -42,6 +42,16 @@ public function setSettingStorage(SettingStorage $settingStorage) } } + /** + * Sets the current storage group. + * + * @param string $groupName + */ + public function setStorageGroup($groupName) + { + $this->settingStorage->group($groupName); + } + /** * Get al the settings from storage * From faf9a7bf8d7f913c5c161ce383933ed47d761a65 Mon Sep 17 00:00:00 2001 From: "AndreaMauro@Home" Date: Wed, 11 Nov 2020 02:25:21 +0100 Subject: [PATCH 06/16] refactor --- src/Setting/AppSettings.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Setting/AppSettings.php b/src/Setting/AppSettings.php index c4db79e..023e298 100644 --- a/src/Setting/AppSettings.php +++ b/src/Setting/AppSettings.php @@ -32,13 +32,12 @@ public function __construct(SettingStorage $settingStorage) */ public function setSettingStorage(SettingStorage $settingStorage) { - $groupName = $this->getSettingsGroupName(); + $this->settingStorage = $settingStorage; + $groupName = $this->getSettingsGroupName(); if( $groupName && is_callable($groupName) ) { $groupName = $this->runCallback($groupName, 'setting_group', null); - $this->settingStorage = $settingStorage->group($groupName); - } else { - $this->settingStorage = $settingStorage; + $this->settingStorage->group($groupName); } } From 3129cc014d67d60a829ec302b159f6fea04effa0 Mon Sep 17 00:00:00 2001 From: "AndreaMauro@Home" Date: Wed, 11 Nov 2020 02:25:55 +0100 Subject: [PATCH 07/16] refactor --- src/Setting/AppSettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Setting/AppSettings.php b/src/Setting/AppSettings.php index 023e298..0bbe2c9 100644 --- a/src/Setting/AppSettings.php +++ b/src/Setting/AppSettings.php @@ -37,7 +37,7 @@ public function setSettingStorage(SettingStorage $settingStorage) $groupName = $this->getSettingsGroupName(); if( $groupName && is_callable($groupName) ) { $groupName = $this->runCallback($groupName, 'setting_group', null); - $this->settingStorage->group($groupName); + $this->setStorageGroup($groupName); } } From 19f793659a5d401ec3fa6658851d45210602cda0 Mon Sep 17 00:00:00 2001 From: "AndreaMauro@Home" Date: Thu, 19 Nov 2020 10:30:42 +0100 Subject: [PATCH 08/16] no message --- src/Setting/AppSettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Setting/AppSettings.php b/src/Setting/AppSettings.php index 0bbe2c9..4723ea1 100644 --- a/src/Setting/AppSettings.php +++ b/src/Setting/AppSettings.php @@ -22,7 +22,7 @@ class AppSettings */ public function __construct(SettingStorage $settingStorage) { - $this->setSettingStorage($settingStorage); + $this->setSettingStorage($settingStorage); } /** From 016df20c4ddce579a54e88f00ee8b4e56ef81d37 Mon Sep 17 00:00:00 2001 From: Mohd Saqueib Ansari Date: Mon, 31 Jan 2022 16:55:24 +0530 Subject: [PATCH 09/16] update deps --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index e0e3739..6861d2f 100644 --- a/composer.json +++ b/composer.json @@ -21,12 +21,12 @@ } ], "require": { - "php": "^7.2", - "laravel/framework": "~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0", - "qcod/laravel-settings": "~1.0" + "php": "^7.3|^8.0", + "laravel/framework": "~5.8.0|^6.0|^7.0|^8.0|^9.0", + "qcod/laravel-settings": "~1.1" }, "require-dev": { - "orchestra/testbench": "3.8.*|4.*|5.*", + "orchestra/testbench": "4.*|5.*|6.*", "mockery/mockery": "^0.9.4 || ~1.0", "phpunit/phpunit": "^8.5" }, From 2b5f1f24cbfc3b5f786948cacb85d3f53a510608 Mon Sep 17 00:00:00 2001 From: Mohd Saqueib Ansari Date: Mon, 31 Jan 2022 17:18:02 +0530 Subject: [PATCH 10/16] fixed typo and version updated --- composer.json | 2 +- src/Setting/AppSettings.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6861d2f..a7fdf1c 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require": { "php": "^7.3|^8.0", "laravel/framework": "~5.8.0|^6.0|^7.0|^8.0|^9.0", - "qcod/laravel-settings": "~1.1" + "qcod/laravel-settings": "^1.1" }, "require-dev": { "orchestra/testbench": "4.*|5.*|6.*", diff --git a/src/Setting/AppSettings.php b/src/Setting/AppSettings.php index c6fe655..e733b90 100644 --- a/src/Setting/AppSettings.php +++ b/src/Setting/AppSettings.php @@ -33,7 +33,7 @@ public function __construct(SettingStorage $settingStorage) } /** - * Get al the settings from storage + * Get all the settings from storage * * @param bool $fresh * @return \Illuminate\Support\Collection From 7aa0318aeb7b3cf7574e646579a18809050e4fc3 Mon Sep 17 00:00:00 2001 From: Mohd Saqueib Ansari Date: Mon, 31 Jan 2022 17:27:00 +0530 Subject: [PATCH 11/16] readme updated --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76af8b5..316ad77 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ If your app needs different url to access the settings page you can change from ### Use Group Setting -Many time you want to store settings in a group. With version `1.1` you can define a group name from your `config/app_settings.php`. You have a closer to return the name of group as string +Many time you want to store settings in a group. With version `1.1` you can define a group name from your `config/app_settings.php`. You have a closer or a class namespace to return the name of group as string ```php return [ @@ -156,7 +156,9 @@ return [ } ``` -In this case you can have different settings for each user. +In this case you can have different settings for each user. + +🔥 You can also set settings group at runtime using `app('app-settings')->setStorageGroup('my-storage-group')`. ### Use without UI From 0879f0344ae57481a0e555889bb39ce7f9bc677a Mon Sep 17 00:00:00 2001 From: Mohd Saqueib Ansari Date: Mon, 31 Jan 2022 17:28:46 +0530 Subject: [PATCH 12/16] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed8a41a..62d1de5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to `qcod/laravel-app-settings` will be documented in this file +## 1.5.0 - 2022-01-31 +- Laravel 9 support +- Runtime group name change using `app('app-settings')->setStorageGroup('my-storage-group')` + + ## 1.4.0 - 2020-09-24 - Laravel 8 support From 0639421b4fd5e08c92be74d9aef13495d90dab54 Mon Sep 17 00:00:00 2001 From: Mohd Saqueib Ansari Date: Mon, 31 Jan 2022 17:30:09 +0530 Subject: [PATCH 13/16] drop l5 support --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a7fdf1c..7eff03c 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ ], "require": { "php": "^7.3|^8.0", - "laravel/framework": "~5.8.0|^6.0|^7.0|^8.0|^9.0", + "laravel/framework": "^6.0|^7.0|^8.0|^9.0", "qcod/laravel-settings": "^1.1" }, "require-dev": { From f1fc086ec31cc7d51ce12ac2a6fc9b212be36637 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 1 Feb 2023 13:07:41 +0000 Subject: [PATCH 14/16] Bump dependencies for Laravel 10 --- composer.json | 110 +++++++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/composer.json b/composer.json index 7eff03c..1d291a0 100644 --- a/composer.json +++ b/composer.json @@ -1,59 +1,59 @@ { - "name": "qcod/laravel-app-settings", - "description": "A package with UI to store and manage all the settings for your application", - "homepage": "https://github.com/qcod/laravel-app-settings", - "type": "library", - "license": "MIT", - "keywords": [ - "qcod", - "laravel", - "database settings", - "db settings", - "app settings", - "setting ui", - "bootstrap", - "eloquent" - ], - "authors": [ - { - "name": "Mohd Saqueib Ansari", - "email": "saquibweb@gmail.com" - } - ], - "require": { - "php": "^7.3|^8.0", - "laravel/framework": "^6.0|^7.0|^8.0|^9.0", - "qcod/laravel-settings": "^1.1" - }, - "require-dev": { - "orchestra/testbench": "4.*|5.*|6.*", - "mockery/mockery": "^0.9.4 || ~1.0", - "phpunit/phpunit": "^8.5" - }, - "autoload": { - "psr-4": { - "QCod\\AppSettings\\": "src/" + "name": "qcod/laravel-app-settings", + "description": "A package with UI to store and manage all the settings for your application", + "homepage": "https://github.com/qcod/laravel-app-settings", + "type": "library", + "license": "MIT", + "keywords": [ + "qcod", + "laravel", + "database settings", + "db settings", + "app settings", + "setting ui", + "bootstrap", + "eloquent" + ], + "authors": [ + { + "name": "Mohd Saqueib Ansari", + "email": "saquibweb@gmail.com" + } + ], + "require": { + "php": "^7.3|^8.0", + "laravel/framework": "^6.0|^7.0|^8.0|^9.0|^10.0", + "qcod/laravel-settings": "^1.1" }, - "files": [ - "src/helpers.php" - ] - }, - "autoload-dev": { - "psr-4": { - "QCod\\AppSettings\\Tests\\": "tests/" - } - }, - "extra": { - "laravel": { - "providers": [ - "QCod\\AppSettings\\AppSettingsServiceProvider" - ], - "aliases": { - "AppSettings": "QCod\\AppSettings\\Facade" - } + "require-dev": { + "orchestra/testbench": "4.*|5.*|6.*|^8.0", + "mockery/mockery": "^0.9.4 || ~1.0", + "phpunit/phpunit": "^8.5|^9.5.10" + }, + "autoload": { + "psr-4": { + "QCod\\AppSettings\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "autoload-dev": { + "psr-4": { + "QCod\\AppSettings\\Tests\\": "tests/" + } + }, + "extra": { + "laravel": { + "providers": [ + "QCod\\AppSettings\\AppSettingsServiceProvider" + ], + "aliases": { + "AppSettings": "QCod\\AppSettings\\Facade" + } + } + }, + "scripts": { + "test": "vendor/bin/phpunit" } - }, - "scripts": { - "test": "vendor/bin/phpunit" - } } From a2e21db090b6539c9dfa4283916cea5707196903 Mon Sep 17 00:00:00 2001 From: Shift Date: Sat, 2 Mar 2024 00:27:17 +0000 Subject: [PATCH 15/16] Bump dependencies for Laravel 11 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 1d291a0..b215410 100644 --- a/composer.json +++ b/composer.json @@ -22,13 +22,13 @@ ], "require": { "php": "^7.3|^8.0", - "laravel/framework": "^6.0|^7.0|^8.0|^9.0|^10.0", + "laravel/framework": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", "qcod/laravel-settings": "^1.1" }, "require-dev": { - "orchestra/testbench": "4.*|5.*|6.*|^8.0", + "orchestra/testbench": "4.*|5.*|6.*|^8.0|^9.0", "mockery/mockery": "^0.9.4 || ~1.0", - "phpunit/phpunit": "^8.5|^9.5.10" + "phpunit/phpunit": "^8.5|^9.5.10|^10.5" }, "autoload": { "psr-4": { From ac2ae4183e41dd634862e7a081fa7cb20cd30752 Mon Sep 17 00:00:00 2001 From: Shift Date: Wed, 19 Feb 2025 02:11:39 +0000 Subject: [PATCH 16/16] Bump dependencies for Laravel 12 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index b215410..1f45ef6 100644 --- a/composer.json +++ b/composer.json @@ -22,13 +22,13 @@ ], "require": { "php": "^7.3|^8.0", - "laravel/framework": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "laravel/framework": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", "qcod/laravel-settings": "^1.1" }, "require-dev": { - "orchestra/testbench": "4.*|5.*|6.*|^8.0|^9.0", + "orchestra/testbench": "4.*|5.*|6.*|^8.0|^9.0|^10.0", "mockery/mockery": "^0.9.4 || ~1.0", - "phpunit/phpunit": "^8.5|^9.5.10|^10.5" + "phpunit/phpunit": "^8.5|^9.5.10|^10.5|^11.5.3" }, "autoload": { "psr-4": {