thefx/yii2-blocks

安装: 193

依赖: 1

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

公开问题: 0

类型:yii2-extension

1.0.0 2023-04-21 06:53 UTC

This package is auto-updated.

Last update: 2024-09-11 08:22:08 UTC


README

安装

安装此扩展的首选方式是通过 composer.

composer require thefx/yii2-blocks:dev-master

或者

"thefx/yii2-blocks": "dev-master"

将以下内容添加到您的 composer.json 文件的 require 部分。

应用迁移

php yii migrate --migrationPath=@thefx/blocks/migrations

修改您的应用程序配置

return [
    'modules' => [
        'blocks' => [
            'class' => 'thefx\blocks\Module',
            'layoutPath' => '@app/modules/admin/layouts',
            'layout' => 'page',
            'layoutPure' => 'pure',
            'rootUsers' => [1],
        ...
        ]
        ...
    ],
];

仅对认证用户添加访问权限

    'as access blocks' => [
        'class' => 'yii\filters\AccessControl',
        'only' => ['pages/*', 'blocks/*'],
        'rules' => [
            [
                'allow' => true,
                'roles' => ['@'],
            ],
        ],
    ],

使用方法

创建块

http://site.com/blocks/block