Download the PHP package zgldh/laravel-taggable without Composer
On this page you can find all versions of the php package zgldh/laravel-taggable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-taggable
Laravel Taggable
Introduction
Tag support for Laravel Eloquent models using Taggable Trait.
This project extends rtconner/laravel-tagging , add the following feature specially for Chinese User:
- Tag name unique, and using
tag_id
for query data. - Add etrepat/baum support complicated tag tree;
- Chinese Pinyin slug support using overtrue/pinyin;
- Full test coverage。
Notice: This projcet only tested and intended only support 5.1 LTS.
:heart: This project is maintained by @Summer, member of The EST Group.
中文文档和讨论请见这里:https://phphub.org/topics/2123
Baum Nested Sets
Integarated etrepat/baum, what is Nested Sets?
A nested set is a smart way to implement an ordered tree that allows for fast, non-recursive queries. For example, you can fetch all descendants of a node in a single query, no matter how deep the tree.
Please refer the Official Project for more advance usage - etrepat/baum
Tag name rules
- Any special charactor and empty space will be replace by
-
; - Automatically smart slug generation, generate Chinese Pinyin slug, fore example:
标签
->biao-qian
, will add random value when there is a conflict.
Tag name normalizer:
$normalize_string = EstGroupe\Taggable\Util::tagName($name)
。
Installation:
Composer install package
Config and Migration
Change providers
array at config/app.php
:
Please take a close look at file:
config/taggable.php
Create your own Tag.php
It's optional but suggested to use your own Tag
Model:
Change config/taggable.php
file:
Adding Taggable Trait
is_tagged
Label
Taggable
can keep track of the model Tagged Status
:
First modify config/taggable.php
:
Add is_tagged
filed to you model Migration file:
Suggesting
tags
Suggesting is a small little feature you could use if you wanted to have "suggested" tags that stand out.
There is not much to it. You simply set the 'suggest' field in the database to true
And then you can fetch a list of suggested tags when you need it.
Rewrite Util class?
How do I override the Util class?
You'll need to create your own service provider. It should look something like this.
Notice: Where
MyNewUtilClass
is a class you have written. Your new Util class obviously needs to implement theEstGroupe\Taggable\Contracts\TaggingUtility
interface.
Usage
EstGroupe\Taggable\Model\Tag
has the following functions:
Tagging events
Taggable
trait offer you two events:
You can listen to it as you want:
Unit testing
Common usage are tested at tests/CommonUsageTest.php
file.
Running test:
Thanks
- Special Thanks to: Robert Conner - http://smartersoftware.net
- overtrue/pinyin
- etrepat/baum
- Made with love by The EST Group - http://estgroupe.com/
All versions of laravel-taggable with dependencies
illuminate/database Version >= 5.0
illuminate/support Version >= 5.0
baum/baum Version ~1.1
overtrue/pinyin Version ~3.0