Neuron-PHP

ICategoryRepository

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

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]

delete()

Delete a category

public delete(int $id) : bool
Parameters
$id : int
Return values
bool

findByIds()

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>

        
On this page

Search results