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

This package is auto-updated.

Last update: 2020-01-22 22:41:14 UTC


README

Author

Denis Mitrofanov

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)

Version 1.1

LICENSE

MIT