it-yakutia/yii2-setting

Setting module for Yii2

Installs: 705

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

v1.0.1 2022-06-21 21:34 UTC

This package is auto-updated.

Last update: 2024-04-22 10:58:44 UTC


README

Setting module for Yii2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist it-yakutia/yii2-setting "*"

or add

"it-yakutia/yii2-setting": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply add in your console config:

'controllerMap' => [
    /* ... */
    'migrate' => [
            // 'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => [
                // '@console/migrations', // yii migrate/create app_init
                // '@yii/rbac/migrations',
                /* ... */
                '@vendor/it-yakutia/yii2-setting/src/migrations'
            ],
    ],
],

And just run the command:

php yii migrate

Add urls in your backend project:

Url::toRoute('/setting/back/index');

Check permission settings that it are added to your RBAC role

Use in front:

<span><a href="<?= Setting::valueOf('social_link_vk'); ?>"><i class="fab fa-vk"></i></a></span>

or

<?= Setting::valueOf('social_link_vk', '<span><a href="[[value]]"><i class="fab fa-vk"></i></a></span>'); ?>