qcod / laravel-app-settings

Store settings in database with a manager UI for your Laravel app
MIT License
338 stars 53 forks source link

Refactor of AppSetting storage to allow extension #32

Closed Bibendus83 closed 2 years ago

Bibendus83 commented 3 years ago

I had severe issues trying to extend the AppSetting class due to the amount of private methods. For this reason I decided to change all methods from private to protected. Additionally I refactored the constructor and moved the storage group init in a separate function that can be called when you need to redefine the storage group name. In my case I had a problem with multitenant Queues (using the library https://github.com/tenancy/multi-tenant). The group was defined once for queue and all tenant jobs were called using the first defined setting group.

To change the setting group at runtime you can call this function: app('app-settings')->setStorageGroup('my-storage-group')