一个用于位置和地址管理的Yii2扩展

安装: 17

依赖: 0

建议者: 0

安全: 0

星星: 1

关注者: 1

分支: 1

公开问题: 0

类型:yii2-extension

dev-master 2018-01-30 22:29 UTC

This package is auto-updated.

Last update: 2024-08-28 04:24:40 UTC


README

为提供位置管理功能的Yii2扩展。

安装此扩展的首选方法是使用composer

运行以下命令之一

composer require "kmergen/yii2-location: "*"

"kmergen/yii2-location": "*",

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

安装

1. 运行迁移

运行 $ yii migrate --migrationPath=@vendor/kmergen/yii2-location/migrations

使用Yii2-location与Yii2基本模板

配置应用程序

在配置文件中设置以下内容

'bootstrap' => [
    'kmergen\location\Bootstrap',
    ...
],
'modules' => [
    'location' => [
        'class' => 'kmergen\location\Module'
    ],
    ...
]

这就是全部。Yii-2位置已经准备就绪。

使用Yii2-location与Yii2高级模板

当使用高级模板时,前端和后端可能会有一些特殊的限制。

配置应用程序

让我们从在@common/config/main.php中定义模块开始

'bootstrap' => [
    'kmergen\location\Bootstrap',
    ...
],
'modules' => [
    'location' => [
        'class' => 'kmergen\location\Module',
        // you will configure your module inside this file
        // or if need different configuration for frontend and backend you may
        // configure in needed configs
    ],
],

限制前端对管理员控制器的访问。打开@frontend/config/main.php并添加以下内容

'modules' => [
    'location' => [
        // following line will restrict access to admin controller from frontend application
        'as frontend' => 'kmergen\location\filters\FrontendFilter',
    ],
],

限制后端对前端控制器操作的访问。打开@backend/config/main.php并添加以下内容

'modules' => [
    'location' => [
        // following line will restrict access to actions of controller from backend
        'as backend' => 'kmergen\location\filters\BackendFilter',
    ],
],

这就全部了,现在您已安装并配置了高级模板中的模块。

注意:此扩展处于开发中。请勿在生产环境中使用。