PHP Interface Cviebrock\EloquentTaggable\Taggable

ファイルを表示 Open project: cviebrock/eloquent-taggable

Public Methods

Method Description
allTags ( ) : array Get an array of all tags used for the called class.
allTagsList ( ) : string Get all the tags used for the called class as a delimited string.
detag ( ) Remove all tags from the model.
getTagArrayAttribute ( ) : array Get all tags of a Model as an array.
getTagArrayNormalizedAttribute ( ) : array Get all normalized tags of a Model as an array.
getTagListAttribute ( ) : string Get all tags of a Model as a string in which the tags are delimited by the character defined in config('taggable.delimiters').
getTagListNormalizedAttribute ( ) : string Get all normalized tags of a Model as a string in which the tags are delimited by the character defined in config('taggable.delimiters').
retag ( string | array $tags ) Remove all Tags from a Model and assign the given ones.
scopeWithAllTags ( Builder $query, array | string $tags ) : Builder Scope for a Model that has all of the given tags.
scopeWithAnyTags ( Builder $query, array $tags = [] ) : Builder Scope for a Model that has any of the given tags.
scopeWithoutTags ( Builder $query ) : Builder Scope for a Model that doesn't have any tags.
tag ( string | array $tags ) Attach one or multiple Tags to a Model.
tags ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany Get a collection of all Tags a Model has.
untag ( string | array $tags ) Detach one or multiple Tags from a Model.

Protected Methods

Method Description
addOneTag ( string $tagName ) Add one tag to the model.
removeOneTag ( string $tagName ) Remove one tag from the model

Method Details

addOneTag() protected method

Add one tag to the model.
protected addOneTag ( string $tagName )
$tagName string

allTags() public static method

Get an array of all tags used for the called class.
public static allTags ( ) : array
return array

allTagsList() public static method

Get all the tags used for the called class as a delimited string.
public static allTagsList ( ) : string
return string

detag() public method

Remove all tags from the model.
public detag ( )

getTagArrayAttribute() public method

Get all tags of a Model as an array.
public getTagArrayAttribute ( ) : array
return array

getTagArrayNormalizedAttribute() public method

Get all normalized tags of a Model as an array.

getTagListAttribute() public method

Get all tags of a Model as a string in which the tags are delimited by the character defined in config('taggable.delimiters').
public getTagListAttribute ( ) : string
return string

getTagListNormalizedAttribute() public method

Get all normalized tags of a Model as a string in which the tags are delimited by the character defined in config('taggable.delimiters').

removeOneTag() protected method

Remove one tag from the model
protected removeOneTag ( string $tagName )
$tagName string

retag() public method

Remove all Tags from a Model and assign the given ones.
public retag ( string | array $tags )
$tags string | array

scopeWithAllTags() public method

Scope for a Model that has all of the given tags.
public scopeWithAllTags ( Builder $query, array | string $tags ) : Builder
$query Illuminate\Database\Eloquent\Builder
$tags array | string
return Illuminate\Database\Eloquent\Builder

scopeWithAnyTags() public method

Scope for a Model that has any of the given tags.
public scopeWithAnyTags ( Builder $query, array $tags = [] ) : Builder
$query Illuminate\Database\Eloquent\Builder
$tags array
return Illuminate\Database\Eloquent\Builder

scopeWithoutTags() public method

Scope for a Model that doesn't have any tags.
public scopeWithoutTags ( Builder $query ) : Builder
$query Illuminate\Database\Eloquent\Builder
return Illuminate\Database\Eloquent\Builder

tag() public method

Attach one or multiple Tags to a Model.
public tag ( string | array $tags )
$tags string | array

tags() public method

Get a collection of all Tags a Model has.
public tags ( ) : Illuminate\Database\Eloquent\Relations\MorphToMany
return Illuminate\Database\Eloquent\Relations\MorphToMany

untag() public method

Detach one or multiple Tags from a Model.
public untag ( string | array $tags )
$tags string | array