承接 mhndev/yii2-taxonomy-term 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mhndev/yii2-taxonomy-term

Composer 安装命令:

composer require mhndev/yii2-taxonomy-term

包简介

taxonomy term implementation in Yii2

README 文档

README

taxonomy term implementation in Yii2

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist mhndev/yii2-taxonomy-term "1.*"

or add

"mhndev/yii2-taxonomy-term": "1.*"

to the require section of your composer.json file.

Execute Migrations

php yii migrate --migrationPath=@vendor/mhndev/yii2-taxonomy-term/src/migrations

Usage

user mhndev\yii2TaxonomyTerm\traits\TermableTrait in each Model which you want to use taxonomy-term for

example

Post Model
class Post extends ActiveRecord
{

    use TermableTrait;

    /**
     * @return string
     */
    public static function tableName()
    {
        return 'posts';

    }

    /**
     * @return array
     */
    public function rules()
    {
        return [
            [['title'], 'required'],
            [['text'], 'required'],
        ];
    }

}

attach a term to an entity

    $term = Term::findOne(['id'=>1]);
    $post = Post::findOne(['id'=>1]);
    $post->attachTerm($term);

detach a term from an entity

    $term = Term::findOne(['id'=>1]);
    $post = Post::findOne(['id'=>1]);
    $post->detachTerm($term);

list terms of an entity

    $post = Post::findOne(['id'=>1]);
    $post->listTerms();

get term tree

    $term = Term::findOne(['id'=>1]);
    $term->getTree();

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固