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