Download the PHP package arthurydalgo/lara-settings without Composer
On this page you can find all versions of the php package arthurydalgo/lara-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arthurydalgo/lara-settings
More information about arthurydalgo/lara-settings
Files in arthurydalgo/lara-settings
Informations about the package lara-settings
Settings for Laravel
Basic settings for Laravel 9+. Can be either global or morphed to models.
Requirements
- PHP >= 8.1
- Laravel >= 9.0
Installation
Then publish vendor resources and migration
Finally, you should run migration
Basic usage
Scoping to models
Using global scopes
It easier to use global scope for models that won't change during request, eg. logged in user. Which is globally scoped by default, but here is example how to do it manually, eg. you need to persist scope in command.
Settings definitions
Every setting has to have definition. This way it is always of the same type and can have default values. Settings definitions are declared under static method getSettingsDefinitions
.
Remember
Global settings are defined on
Setting
model.
Instead of storing each field of address in separate setting. You can use class which will be then casted to json.
Models
If you want to have settings on model you need to use HasSettings
trait and declare some settings definitions.
Now you can get their settings.
License
npabisz/laravel-settings
is released under the MIT License. See the bundled LICENSE for details.
All versions of lara-settings with dependencies
ext-json Version *
illuminate/contracts Version ^9.0|^10.0
illuminate/database Version ^9.0|^10.0
illuminate/support Version ^9.0|^10.0