micahalsn/codeigniter-tags

CodeIgniter 4框架的标签

v1.1.1 2024-01-05 14:57 UTC

This package is auto-updated.

Last update: 2024-09-17 19:13:52 UTC


README

一个库,帮助你在CodeIgniter 4框架中构建围绕现有模型的功能。

PHPUnit PHPStan Deptrac Coverage Status

PHP CodeIgniter

安装

composer require michalsn/codeigniter-tags

迁移你的数据库

php spark migrate --all

配置

HasTags特质添加到你的模型中,并通过initTags()方法初始化标签。

class ExampleModel extends BaseModel
{
    use HasTags;

    // ...

    protected function initialize()
    {
        $this->initTags();
    }

    // ...
}

如果你使用实体类,添加TaggableEntity特质到它

class Example extends Entity
{
    use TaggableEntity;

    // ...
}

文档

https://michalsn.github.io/codeigniter-tags/