Download the PHP package mxrck/laravel-dboptions without Composer
On this page you can find all versions of the php package mxrck/laravel-dboptions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mxrck/laravel-dboptions
More information about mxrck/laravel-dboptions
Files in mxrck/laravel-dboptions
Package laravel-dboptions
Short Description Create database based options for your laravel projects
License
Homepage https://github.com/mxrck/laravel-dboptions
Informations about the package laravel-dboptions
Laravel DB Options
Use the database to store key/value options, with preload function and context objects with fallback to global options
Install
Usage
There are two ways to use the options store, by facade or helpers
Simple facade usage
If you only need a database key/value to store data, then you can use the simplest way
Simple helper usage
Context usage
This feature was requested by @atxy2k
If you need a more advanced usage, like set options per user, with fallback to default option system or fallback to a default value, then you can use an option context. This contexts make use of polymorphic relations to create specific options, you can make any model to be optionable if you wish.
You need to implement the OptionableInterface, and use the OptionableTrait in the model you want to be optionable like this.
In the case you customize your morph map, you need to override and extra method in your model
now you can use the facade or helpers with an optionable context like this
Some examples
There are some hidden features undocumented yet, but the basic usage is here
Console
Create or update an option
Get an option
List all current options
Testing
WIP
There are no Context testing yet
Contributing
Thanks in advance, for all the contributions
Support me
You can follow me on Twitter, buy me a coffee or support me on Patreon
License
The MIT License (MIT). Please see License File for more information.