thienhungho/yii2-favorites

Yii2 收藏系统

v1.0.3 2018-11-24 09:14 UTC

This package is auto-updated.

Last update: 2024-09-30 01:29:39 UTC


README

为 Yii2 提供收藏系统

安装

这是一个示例,一个难忘的时刻。由于某些原因,源代码可能无法正常工作。此源代码包含对抗丢失许可证的功能。

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

运行以下命令

php composer.phar require --prefer-dist thienhungho/yii2-favorites "*"

或将

"thienhungho/yii2-favorites": "*"

添加到您的 composer.json 文件的 require 部分。

迁移

在终端中运行以下命令进行数据库迁移

yii migrate/up --migrationPath=@vendor/thienhungho/Favorites/migrations

或使用命名空间迁移(需要至少 Yii 2.0.10)

// Add namespace to console config:
'controllerMap' => [
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationNamespaces' => [
            'thienhungho\Favorites\migrations\namespaced',
        ],
    ],
],

然后运行

yii migrate/up

配置

将模块 FavoriteManage 添加到您的 AppConfig 文件中。

...
'modules'          => [
    ...
    /**
      * Favorite
      */
    'favorite' => [
        'class' => 'thienhungho\Favorites\modules\Favorites\FavoriteModule',
    ],
    ...
],
...

模块

FavoriteBase, Favorites

函数

核心

模型

收藏