Download the PHP package remzikocak/laravel-options without Composer
On this page you can find all versions of the php package remzikocak/laravel-options. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download remzikocak/laravel-options
More information about remzikocak/laravel-options
Files in remzikocak/laravel-options
Package laravel-options
Short Description Database Options/Settings Package for Laravel 9/10/11/12.
License MIT
Informations about the package laravel-options
Laravel Options Package
This Package will help you to dynamically add Option fields to your Backend Panel.
Installation
You can install the package via composer:
The Package will automatically register the Service Provider and Facade. Afterwards, you need to publish and migrate:
This will create the migration files and options.php file in your config folder.
Usage
First of all, you need to create a Optiongroup and an Option.
Option groups and options have a many-to-many relationship. Groups can have many options, and options can belong to many groups. Understanding this relationship is essential for displaying them in your backend panel.
For assignment, use the following:
Getting options
To retrieve the computed value, use the method from the Option Model.
A better and more performant option is to utilize the Facade. This will cache the options when you only require a key => value store.
You can use it as following:
Check if option with the given name exists
While the cache usually refreshes automatically, if you need to do it manually, use the following method.
Adding custom Types
To add your custom type, you need to create a class that extends
Example:
then add the class in configuration file to the types array. After that you can use it like all other types.
Rendering HTML for Edit Form
Rendering options is straightforward with a few pre-added "Types."
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-options with dependencies
ext-json Version *
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0