PHP Class Cviebrock\EloquentTaggable\Services\TagService

Datei anzeigen Open project: cviebrock/eloquent-taggable

Public Methods

Method Description
buildTagArray ( string | array $tags ) : array Convert a delimited string into an array of tag strings.
buildTagArrayNormalized ( string | array $tags ) : array Convert a delimited string into an array of normalized tag strings.
find ( string $tagName ) : Tag | null Find an existing tag by name.
findOrCreate ( string $tagName ) : Tag Find an existing tag (or create a new one) by name.
getAllTags ( Model | string $class ) : Illuminate\Database\Eloquent\Collection Get all Tags for the given class.
joinList ( array $array ) : string Join a list of strings together using glue.
makeTagArray ( Model $model, string $field = 'name' ) : array Build a simple array of a model's tags.
makeTagList ( Model $model, string $field = 'name' ) : string Build a delimited string from a model's tags.
normalize ( string $string ) : mixed Normalize a string.

Method Details

buildTagArray() public method

Convert a delimited string into an array of tag strings.
public buildTagArray ( string | array $tags ) : array
$tags string | array
return array

buildTagArrayNormalized() public method

Convert a delimited string into an array of normalized tag strings.
public buildTagArrayNormalized ( string | array $tags ) : array
$tags string | array
return array

find() public method

Find an existing tag by name.
public find ( string $tagName ) : Tag | null
$tagName string
return Cviebrock\EloquentTaggable\Models\Tag | null

findOrCreate() public method

Find an existing tag (or create a new one) by name.
public findOrCreate ( string $tagName ) : Tag
$tagName string
return Cviebrock\EloquentTaggable\Models\Tag

getAllTags() public method

Get all Tags for the given class.
public getAllTags ( Model | string $class ) : Illuminate\Database\Eloquent\Collection
$class Illuminate\Database\Eloquent\Model | string
return Illuminate\Database\Eloquent\Collection

joinList() public method

Join a list of strings together using glue.
public joinList ( array $array ) : string
$array array
return string

makeTagArray() public method

Build a simple array of a model's tags.
public makeTagArray ( Model $model, string $field = 'name' ) : array
$model Illuminate\Database\Eloquent\Model
$field string
return array

makeTagList() public method

Build a delimited string from a model's tags.
public makeTagList ( Model $model, string $field = 'name' ) : string
$model Illuminate\Database\Eloquent\Model
$field string
return string

normalize() public method

Normalize a string.
public normalize ( string $string ) : mixed
$string string
return mixed