Download the PHP package bonk007/system-settings without Composer
On this page you can find all versions of the php package bonk007/system-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bonk007/system-settings
More information about bonk007/system-settings
Files in bonk007/system-settings
Package system-settings
Short Description Dynamic settings for application
License MIT
Informations about the package system-settings
Laravel Settings
- Install
- How to
- Set Value
- Get Value
- Remove Value
- Configurable Model
- How to Define
- How it works
- Accepted Value
Install
Install the package using composer
then run migration
that's all :zap:
How to
Set setting's value
example
if you need to set some value for specific configurable model (learn: what is configurable model)
example
or you can use
example
Get setting's value
for specific configurable model
or using simple way
example
Remove setting
with specific configurable model
or
example
Configurable Model
Configurable model is a Eloquent Model represents an instance that owns custom configurations value.
How to define
Model should implement \Settings\Configurable::class
interface
example
Be careful, using shortcut settings()->set('<group>.<key>.<table of configurable model>.<primary key>', <value>);
, there is possibility you will store non-configurable model into settings table, then you can't use settings()->for(\App\Models\Organization::find(6))
for any function.
How it works
Configurable model will be stored as polymorphic relation at settings table. The field columns are configurable_table
and configurable_id
. By default configurable_id
has unsigned bigint
type, but you can change the type by define static variable \Settings\Manager::$configurableMorphType
value with uuid|int|string
at AppServiceProvider
before you run artisan migrate
.
Accepted Value
string
boolean
double/float
integer
array
\DatetimeInterface
- Eloquent Model
- Model Collection
- Basic Collection