sadi01 / yii2-more-settings
处理 Yii2 框架的设置
v1.0.0
2022-12-02 07:22 UTC
Requires
- ext-curl: *
- ext-json: *
- kartik-v/yii2-bootstrap4-dropdown: @dev
- kartik-v/yii2-grid: @dev
- kartik-v/yii2-number: @dev
- kartik-v/yii2-widget-fileinput: @dev
- sadi01/yii2-daterangepicker: *
- yiisoft/yii2: ~2.0.14
- yiisoft/yii2-jui: ^2.0@dev
This package is auto-updated.
Last update: 2024-09-18 13:19:57 UTC
README
处理 Yii 2 的设置
有关许可信息,请查看 LICENSE 文件。
安装
1. 下载
安装此扩展的首选方法是使用 composer
composer require --prefer-dist sadi01/yii2-more-settings:"*"
2. 配置
要使用此扩展,您必须在应用程序配置中配置 PostService 类
return [ //.... 'modules' => [ 'moresettings' => [ 'class' => 'sadi01\moresettings\SettingsModule', 'rootAlias' => '@webroot', 'webAlias' => '@web', ], ] ];
3. 更新数据库架构
您需要做的最后一件事是通过应用迁移来更新您的数据库架构。确保您已正确配置 db
应用程序组件,并运行以下命令
$ php yii migrate/up --migrationPath=@vendor/sadi01/yii2-more-settings/src/migrations
如何使用
管理设置类别和设置
http://yourdomain/moresettings/default/index http://yourdomain/moresettings/setting-cat/index
获取设置值
use sadi01\moresettings\models\SettingValue; SettingValue::getValue('settingCategory', 'settingName')
设置小部件以更改设置值
use sadi01\moresettings\widgets\SettingsWidget <?= SettingsWidget::widget([ 'model' => $model, 'categoryName' => 'mainSettings', // name of Setting category 'settingName' => 'apiBaseUrl' // name of setting ]) ?>