grooveland / settings
Laravel settings handler
Installs: 81
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
This package is auto-updated.
Last update: 2024-11-07 03:29:12 UTC
README
This package allows you to manage settings in a database.
The settings are handled by groups and types of data (string, boolean, integer, double, array)
Installation
Laravel
This package can be used in Laravel 5.4 or higher.
You can install via composer:
composer require grooveland/settings
In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php file:
'providers' => [
// ...
\Grooveland\Settings\SettingsServiceProvider::class,
];
Now, run your migrations:
php artisan migrate
Usage
this is a list of basic methods in model
/**
* Add a settings value
*
* @param $name
* @param $val
* @param string $type | optional
* @return bool
*/
public static function add($group, $name, $val, $type = Core::DEFAULT_TYPE);
/**
* Edit a settings by id
* allow to change name, group, value and type
*
* @param $id
* @param $group
* @param $name
* @param $val
* @param string $type | optional
* @return bool
*/
public static function edit($id, $group, $name, $val, $type = Core::DEFAULT_TYPE);
/**
* Get settings by group or by group and name
* if first is true return only first found setting
*
* @param string $group
* @param string $name
* @param boolean $first (false)
* @return Settings | Array
*/
public static function get(string $group, string $name = null, bool $first = false);
/**
* Get first settings by group or by group and name
*
* @param string $group
* @param string $name
* @return Settings | Array
*/
public static function first(string $group, string $name = null);
/**
* Get first settings name
*
* @param string $name
* @return Settings | Array
*/
public static function one(string $name);
/**
* Check if exists settings by name
*
* @param string $name
* @return boolean
*/
public static function exists($name);
This is a CONSTAT with available types
\Grooveland\Settings\Core::TYPES
Contributing
Comming soon.
Security
If you discover any security-related issues, please email develop@thegrooveland.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.