PHP Class BookStack\Repos\TagRepo

Show file Open project: ssddanbrown/bookstack

Protected Properties

Property Type Description
$entity
$permissionService
$tag

Public Methods

Method Description
__construct ( Tag $attr, Entity $ent, PermissionService $ps ) TagRepo constructor.
getEntity ( $entityType, $entityId, string $action = 'view' ) Get an entity instance of its particular type.
getForEntity ( string $entityType, integer $entityId ) : mixed Get all tags for a particular entity.
getNameSuggestions ( $searchTerm = false ) : array Get tag name suggestions from scanning existing tag names.
getValueSuggestions ( $searchTerm = false, $tagName = false ) : array Get tag value suggestions from scanning existing tag values.
saveTagsToEntity ( Entity $entity, array $tags = [] ) : array | Illuminate\Database\Eloquent\Collection Save an array of tags to an entity

Protected Methods

Method Description
newInstanceFromInput ( $input ) : static Create a new Tag instance from user input.

Method Details

__construct() public method

TagRepo constructor.
public __construct ( Tag $attr, Entity $ent, PermissionService $ps )
$attr BookStack\Tag
$ent BookStack\Entity
$ps BookStack\Services\PermissionService

getEntity() public method

Get an entity instance of its particular type.
public getEntity ( $entityType, $entityId, string $action = 'view' )
$entityType
$entityId
$action string

getForEntity() public method

Get all tags for a particular entity.
public getForEntity ( string $entityType, integer $entityId ) : mixed
$entityType string
$entityId integer
return mixed

getNameSuggestions() public method

If no search term is given the 50 most popular tag names are provided.
public getNameSuggestions ( $searchTerm = false ) : array
$searchTerm
return array

getValueSuggestions() public method

If no search is given the 50 most popular values are provided. Passing a tagName will only find values for a tags with a particular name.
public getValueSuggestions ( $searchTerm = false, $tagName = false ) : array
$searchTerm
$tagName
return array

newInstanceFromInput() protected method

Create a new Tag instance from user input.
protected newInstanceFromInput ( $input ) : static
$input
return static

saveTagsToEntity() public method

Save an array of tags to an entity
public saveTagsToEntity ( Entity $entity, array $tags = [] ) : array | Illuminate\Database\Eloquent\Collection
$entity BookStack\Entity
$tags array
return array | Illuminate\Database\Eloquent\Collection

Property Details

$entity protected property

protected $entity

$permissionService protected property

protected $permissionService

$tag protected property

protected $tag