denismitr / tagging
This package is abandoned and no longer maintained.
No replacement package was suggested.
A tagging package for Laravel
1.15
2017-04-19 09:00 UTC
Requires
- php: >=5.5.0
- illuminate/database: >= 5.0
- illuminate/support: >= 5.0
Requires (Dev)
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~5.0
README
Author
Installation
composer require denismitr/tagging
Set Service provider
Denismitr\Tagging\TaggingServiceProvider::class
Add trait to your model
use Taggable;
Available API
Methods on the trait
/** * Get tags relationship * * @return MorphToMany */ public function tags() /** * Tag with one or more tags * * @param array|string|Tag $tags * @return void */ public function tag($tags) /** * Remove tag or tags * * @param array|string|Tag $tags * @return void */ public function untag($tags = null) /** * Remove all tags and then add tag or tags * * @param array|string|Tag $tags * @return void */ public function retag($tags)
Scopes on the trait
public function scopeWithAnyTag($query, array $tags) public function scopeWithAllTag($query, array $tags) public function scopeHasTags($query, array $tags) public function scopeUsedGte($query, $count) public function scopeUsedGt($query, $count) public function scopeUsedLte($query, $count) public function scopeUsedLt($query, $count)