ITagRepository
in
Tag repository interface.
Table of Contents
Methods
- all() : array<string|int, Tag>
- Get all tags
- allWithPostCount() : array<string|int, mixed>
- Get tags with post count
- count() : int
- Count total tags
- create() : Tag
- Create a new tag
- delete() : bool
- Delete a tag
- findById() : Tag|null
- Find tag by ID
- findByName() : Tag|null
- Find tag by name
- findBySlug() : Tag|null
- Find tag by slug
- update() : bool
- Update an existing tag
Methods
all()
Get all tags
public
all() : array<string|int, Tag>
Return values
array<string|int, Tag>allWithPostCount()
Get tags with post count
public
allWithPostCount() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of ['tag' => Tag, 'post_count' => int]
count()
Count total tags
public
count() : int
Return values
intcreate()
Create a new tag
public
create(Tag $tag) : Tag
Parameters
- $tag : Tag
Return values
Tagdelete()
Delete a tag
public
delete(int $id) : bool
Parameters
- $id : int
Return values
boolfindById()
Find tag by ID
public
findById(int $id) : Tag|null
Parameters
- $id : int
Return values
Tag|nullfindByName()
Find tag by name
public
findByName(string $name) : Tag|null
Parameters
- $name : string
Return values
Tag|nullfindBySlug()
Find tag by slug
public
findBySlug(string $slug) : Tag|null
Parameters
- $slug : string
Return values
Tag|nullupdate()
Update an existing tag
public
update(Tag $tag) : bool
Parameters
- $tag : Tag