Download the PHP package digitalion/laravel-simple-user-settings without Composer
On this page you can find all versions of the php package digitalion/laravel-simple-user-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download digitalion/laravel-simple-user-settings
More information about digitalion/laravel-simple-user-settings
Files in digitalion/laravel-simple-user-settings
Package laravel-simple-user-settings
Short Description A simple method for managing user settings
License MIT
Homepage https://github.com/digitalion/laravel-simple-user-settings
Informations about the package laravel-simple-user-settings
Laravel Simple User Settings
This is a simple way to manage user settings. The settings will be based on the configuration file and then stored within a json field in the users table.
Installation
You can install the package via composer:
Once installed you can publish the configuration file with:
The configuration file will be empty, but you can fill it with any settings your app offers.
Right after that you will need to add the settings
field to the users
table.
Optionally, you can publish the migration to make any changes with:
Usage
The package will offer you the settings
helper with which you can directly access user settings.
Read all settings
With the settings()
command you will get the array of all settings. If the user has no saved settings, all the basic values will be returned.
Reading a value
To read a given settings value you will have to use the settings('key')
command.
To get a nested value, use the dot as a separator. For example: settings('key1.key2.key3')
.
Set a value
The values can be set with the command: settings('key', 'value')
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.