rawilk / laravel-settings

Store Laravel application settings in the database.
https://randallwilk.dev/docs/laravel-settings
MIT License
185 stars 17 forks source link

Fetch/Flush All Settings #32

Closed rawilk closed 1 year ago

rawilk commented 1 year ago

PR adds ability to fetch and flush all settings.

All settings can be fetched at once using all() on the Settings facade. If an array of setting keys are passed in to all, only those specific keys will be fetched. If a context object is supplied (via settings()->context(...), only settings applicable to that context are fetched. A false value may also be supplied for the context, which will only return settings that don't have a context applied to it.

As a note, fetching settings via all() does not use the cache at all. As of right now, I'm not sure of a good way to generate a cache key for multiple settings and even if there was a way, I'm not sure of a good way to bust the cache for those grouped settings when a single setting is updated or deleted using set() and forget().

rawilk commented 1 year ago

Multiple settings can be deleted at once using the flush() method on the settings facade. This will work very similar to how all works.