Download the PHP package larapacks/setting without Composer
On this page you can find all versions of the php package larapacks/setting. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download larapacks/setting
More information about larapacks/setting
Files in larapacks/setting
Package setting
Short Description Persistent Laravel configuration settings.
License MIT
Informations about the package setting
Setting
Description
Setting is an easy, encrypted & cached, database key => value store for your laravel application.
Requirements
- PHP >= 7.2
- Laravel >= 6.0
Installation
Run the following command:
Note: The service provider and
Setting
facade are registered automatically.
Once that's complete, publish the migration and configuration file using:
Then run php artisan migrate
.
Usage
Note: All usage below can be accessed via the helper method
setting()
.
Setting a value:
Setting multiple values:
Retrieving a value:
Retrieving a value or return default value if it doesn't exist:
Retrieving the Setting model for a particular key:
Retrieving all keys with values:
Retrieving the your configured Setting model:
Determining if a setting exists:
Flipping a boolean setting:
Enabling a boolean setting:
Disabling a boolean setting:
Using your own model
To use your own model, change the model
configuration option in your config/settings.php
file.
When you create your own model, be sure to include the trait: Larapacks\Setting\Traits\SettingTrait
:
Encryption
Encryption can be enabled or disabled in the published configuration file. By default, it is enabled.
Encryption is performed by laravel's included helper methods encrypt()
and decrypt()
.
You can enable or disable encryption at any time, however upon disabling encryption you will receive the raw encrypted string for settings that have previously been encrypted.