osaris-uk/app-settings
最新稳定版本:1.2.3
Composer 安装命令:
composer require osaris-uk/app-settings
包简介
Database settings package for Laravel
README 文档
README
About
This package integrates a simple way to store your Laravel app settings in your database.
After running the migrations, you are ready to start using the package.
If your application does not support auto-discovery you will need to register the service provider in config/app.php:
'providers' => [ ... OsarisUk\AppSettings\AppSettingsServiceProvider::class, ]
Model
The model for this package includes the mandatory field key, the value field is nullable. There are also several other optional fields included on this model to aid in creating a user interface, these fields are:
description // Nullable
type // Default = 'text'
validation_rules // Nullable
options // Nullable
group // Nullable
The only fields that are cached for use with the setting() helper are key & value.
Helper
This package includes a helper to access settings anywhere in your app using the defined key for your desired setting:
setting('app_name')
To update or create a new setting you can pass a value as the second argument:
setting('app_name', 'Pattern')
You can also directly access the class by passing no arguments through. This is useful to access the other methods on the model, for example:
setting()->getAllCachedSettings()
Available Methods
setting()->getAllCachedSettings() // Returns collection of all cached settings setting()->settingExists($key) // Returns true / false setting()->getCachedValue($key) // Returns setting value setting()->setCachedValue($key, $value) // Returns new setting value setting()->remove($key) // Returns true / false (Sets value to null & soft deletes the record) setting()::clearCache() // Returns true / false
The model watches for the created, updated & deleted events and triggers setting()::clearCache() for each of these.
统计信息
- 总下载量: 74
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-03-07