elephantsgroup/eg-follow 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

elephantsgroup/eg-follow

Composer 安装命令:

composer require elephantsgroup/eg-follow

包简介

yii2 follow module

README 文档

README

To use Elephants Group follow module first you must install module, then you can use follow widget anywhere in your website.

Installation Steps:

  1. run

php composer.phar require elephantsgroup/eg-follow "*"

or add "elephantsgroup/eg-follow": "*" to the require section of your composer.json file.

  1. migrate database

yii migrate --migrationPath=vendor/elephantsgroup/eg-follow/migrations

  1. add follow module to common configuration (common/config.php file)
    ...
    'follow' => [
        'class' => 'elephantsGroup\follow\Module',
    ],
    ...
]```

4) open access to module in common configuration

```'as access' => [
    'class' => 'mdm\admin\components\AccessControl',
    'allowActions' => [
        ...
        'follow/ajax/*',
        ...
    ]
]```

5) filter admin controller in frontend configuration (frontend/config.php file)

```'modules' => [
    ...
    'follow' => [
        'as frontend' => 'elephantsGroup\follow\filters\FrontendFilter',
    ],
    ...
]```

5) filter ajax controller in backend configuration (backend/config.php file)

```'modules' => [
    ...
    'follow' => [
        'as backend' => 'elephantsGroup\follow\filters\BackendFilter',
    ],
    ...
]```

Using follow widget
===

Anywhere in your code you can use follow widget as follows:
```<?= Follows::widget() ?>```

You need to use Follows widget header in your page:
```use elephantsGroup\follow\components\Follows;```

Follow widget parameters
---

- item (integer): to separate follows between different items.
```<?= Follows::widget(['item' => 1]) ?>```
```<?= Follows::widget(['item' => $model->id]) ?>```

default value for item is 0
- service (integer): to separate follows between various item types.
```<?= Folloes::widget(['service' => 1, 'item' => $model->id]) ?>```

for example you can use different values for different modules in your app, and then use follow widget separately in modules.
default value for service is 0
- color (string): color of unfollowed icon heart, default 'black'
```<?= Follows::widget(['service' => 1, ''item' => $model->id, 'color' => 'yellow']) ?>```

- view_file (string): the view file path for rendering

```<?= Follows::widget([
    'service' => 1,
    'item' => $model->id,
    'color' => 'yellow',
    'view_file' => Yii::getAlias('@frontend') . '/views/follow/widget.php'
]) ?>```

you can use these variables in your customized view:
* service
* item
* color
* is_follow

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固