PHP Interface Cartalyst\Tags\TaggableInterface

Show file Open project: cartalyst/tags

Public Methods

Method Description
addTag ( string $name ) : void Attaches the given tag to the entity.
allTags ( ) : Builder Returns all the tags under the entity namespace.
createTagsModel ( ) : Model Creates a new model instance.
getSlugGenerator ( ) : string Returns the slug generator.
getTagsDelimiter ( ) : string Returns the tags delimiter.
getTagsModel ( ) : string Returns the Eloquent tags model name.
prepareTags ( string | array $tags ) : array Prepares the given tags before being saved.
removeTag ( string $name ) : void Detaches the given tag from the entity.
scopeWhereTag ( Builder $query, string | array $tags, string $type = 'slug' ) : Builder Returns the entities with only the given tags.
scopeWithTag ( Builder $query, string | array $tags, string $type = 'slug' ) : Builder Returns the entities with one of the given tags.
scopeWithoutTag ( Builder $query, string | array $tags, string $type = 'slug' ) : Builder Returns the entities that do not have one of the given tags.
setSlugGenerator ( string $name ) : void Sets the slug generator.
setTags ( string | array $tags, string $type = 'name' ) : boolean Attaches or detaches the given tags.
setTagsDelimiter ( string $delimiter ) Sets the tags delimiter.
setTagsModel ( string $model ) : void Sets the Eloquent tags model name.
tag ( string | array $tags ) : boolean Attaches multiple tags to the entity.
tags ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany Returns the entity Eloquent tag model object.
untag ( string | array | null $tags = null ) : boolean Detaches multiple tags from the entity or if no tags are passed, removes all the attached tags from the entity.

Method Details

addTag() public method

Attaches the given tag to the entity.
public addTag ( string $name ) : void
$name string
return void

allTags() public static method

Returns all the tags under the entity namespace.
public static allTags ( ) : Builder
return Illuminate\Database\Eloquent\Builder

createTagsModel() public static method

Creates a new model instance.
public static createTagsModel ( ) : Model
return Illuminate\Database\Eloquent\Model

getSlugGenerator() public static method

Returns the slug generator.
public static getSlugGenerator ( ) : string
return string

getTagsDelimiter() public static method

Returns the tags delimiter.
public static getTagsDelimiter ( ) : string
return string

getTagsModel() public static method

Returns the Eloquent tags model name.
public static getTagsModel ( ) : string
return string

prepareTags() public method

Prepares the given tags before being saved.
public prepareTags ( string | array $tags ) : array
$tags string | array
return array

removeTag() public method

Detaches the given tag from the entity.
public removeTag ( string $name ) : void
$name string
return void

scopeWhereTag() public static method

Returns the entities with only the given tags.
public static scopeWhereTag ( Builder $query, string | array $tags, string $type = 'slug' ) : Builder
$query Illuminate\Database\Eloquent\Builder
$tags string | array
$type string
return Illuminate\Database\Eloquent\Builder

scopeWithTag() public static method

Returns the entities with one of the given tags.
public static scopeWithTag ( Builder $query, string | array $tags, string $type = 'slug' ) : Builder
$query Illuminate\Database\Eloquent\Builder
$tags string | array
$type string
return Illuminate\Database\Eloquent\Builder

scopeWithoutTag() public static method

Returns the entities that do not have one of the given tags.
public static scopeWithoutTag ( Builder $query, string | array $tags, string $type = 'slug' ) : Builder
$query Illuminate\Database\Eloquent\Builder
$tags string | array
$type string
return Illuminate\Database\Eloquent\Builder

setSlugGenerator() public static method

Sets the slug generator.
public static setSlugGenerator ( string $name ) : void
$name string
return void

setTags() public method

Attaches or detaches the given tags.
public setTags ( string | array $tags, string $type = 'name' ) : boolean
$tags string | array
$type string
return boolean

setTagsDelimiter() public static method

Sets the tags delimiter.
public static setTagsDelimiter ( string $delimiter )
$delimiter string

setTagsModel() public static method

Sets the Eloquent tags model name.
public static setTagsModel ( string $model ) : void
$model string
return void

tag() public method

Attaches multiple tags to the entity.
public tag ( string | array $tags ) : boolean
$tags string | array
return boolean

tags() public method

Returns the entity Eloquent tag model object.
public tags ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany
return Illuminate\Database\Eloquent\Relations\MorphToMany

untag() public method

Detaches multiple tags from the entity or if no tags are passed, removes all the attached tags from the entity.
public untag ( string | array | null $tags = null ) : boolean
$tags string | array | null
return boolean