hisman/option
Composer 安装命令:
composer require hisman/option
包简介
Persistent key value options for Laravel
README 文档
README
Persistent key value options for Laravel.
Installation
Install the package via composer:
composer require hisman/option
Provider
If you're using Laravel < 5.5, you'll need to add the service provider to config/app.php file:
'providers' => [ ... Hisman\Option\OptionServiceProvider::class, ... ]
Alias
Add the alias to config/app.php file:
'aliases' => [ ... 'Option' => Hisman\Option\Facade\Option::class, ... ]
Migration
You must run the migration php artisan migrate before using this package. It creates options table in your database that will be used for storing the options.
Usage
Using Facade
// Set option Option::set('name', 'value'); Option::set('name', [1, 2, 3]); // Get option $option = Option::get('name'); // Get option with default value $option = Option::get('name', 'default value');
Using helper function
// Set option option()->set('name', 'value'); option()->set('name', [1, 2, 3]); // Get option $option = option('name'); $option = option()->get('name'); // Get option with default value $option = option('name', 'default value'); $option = option()->get('name', 'default value');
统计信息
- 总下载量: 50
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-01