Download the PHP package grhone/laravel-settings without Composer
On this page you can find all versions of the php package grhone/laravel-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download grhone/laravel-settings
More information about grhone/laravel-settings
Files in grhone/laravel-settings
Package laravel-settings
Short Description A Laravel package to add settings to your models.
License MIT
Homepage https://github.com/grhone/laravel-settings
Informations about the package laravel-settings
Laravel Settings Package
A Laravel package to manage settings for any Eloquent model. This package allows you to attach settings to any model using the HasSettings trait, retrieve settings with default values, and delete settings.
Installation
-
Install the package via Composer:
-
Add the service provider to
config/app.phpif using Laravel version below 5.5: -
Publish the migration file:
- Run the migrations:
Usage
Using the HasSettings Trait
To use settings with your Eloquent models, simply add the HasSettings trait to your model:
Available Methods
getSetting($key, $default = null)
Retrieve the setting value for a given key. If the setting does not exist, the default value is returned.
setSetting($key, $value)
Set the setting value for a given key.
deleteSetting($key)
Delete the setting for a given key.
Contributing
Thank you for considering contributing to the Laravel Settings Package! You can contribute in many ways, including:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
License
The Laravel Settings Package is open-source software licensed under the MIT license.