fdt2k/laravel-taggable 问题修复 & 功能扩展

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

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

fdt2k/laravel-taggable

最新稳定版本:3.1.1

Composer 安装命令:

composer require fdt2k/laravel-taggable

包简介

README 文档

README

This is a package based on spatie/tags.

New features are:

  • Translations without json (another table)
  • Dynamic binding
  • Nestable tags

installation

Usage

Trait

<?php

namespace App\Models;


use Illuminate\Database\Eloquent\Model;
use KDA\Taggable\Models\Traits\HasTag;

class MyModel extends Model
{

    use HasTag;
 
   

}

Dynamic binding

You can register any model to be taggable without inheritance or any trait. This comes with some limitations especially with other plugins.

To do so, create a new Provider file in app/Providers or use

php artisan make:provider TagsServiceProvider

in the boot method call the registerTaggableModel with any Model class in arguments

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use KDA\Laravel\Attachments\Models\Attachment;
use KDA\Taggable\Facades\Tags;

class TagsServiceProvider extends ServiceProvider
{
   
    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        //
        Tags::registerTaggableModel(Attachment::class);
    }
}

This will add the tags relationship and the created/deleted model event. When interacting with these bound models you'll have to use the Facade

Tagging models

these examples are all made from facade. But if you're using the model trait you can as well call any method from the model without the first argument.

contribute

see Contrbiute.md

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固