class PostRepository

Methods

Builder
query()

Get a new query builder for the posts table.

Builder
queryVisibleTo(User $user = null)

No description

findOrFail(int $id, User $actor = null)

Find a post by ID, optionally making sure it is visible to a certain user, or throw an exception.

Collection
findWhere(array $where = [], User $actor = null, array $sort = [], int $count = null, int $start = 0)

Find posts that match certain conditions, optionally making sure they are visible to a certain user, and/or using other criteria.

array
filterVisibleIds(array $ids, User $actor)

Filter a list of post IDs to only include posts that are visible to a certain user.

int
getIndexForNumber(int $discussionId, int $number, User $actor = null)

Get the position within a discussion where a post with a certain number is. If the post with that number does not exist, the index of the closest post to it will be returned.

Builder
queryIds(array $ids, User $actor = null)

No description

Details

Builder query()

Get a new query builder for the posts table.

Return Value

Builder

protected Builder queryVisibleTo(User $user = null)

Parameters

User $user

Return Value

Builder

Post findOrFail(int $id, User $actor = null)

Find a post by ID, optionally making sure it is visible to a certain user, or throw an exception.

Parameters

int $id
User $actor

Return Value

Post

Exceptions

ModelNotFoundException

Collection findWhere(array $where = [], User $actor = null, array $sort = [], int $count = null, int $start = 0)

Find posts that match certain conditions, optionally making sure they are visible to a certain user, and/or using other criteria.

Parameters

array $where
User $actor
array $sort
int $count
int $start

Return Value

Collection

array filterVisibleIds(array $ids, User $actor)

Filter a list of post IDs to only include posts that are visible to a certain user.

Parameters

array $ids
User $actor

Return Value

array

int getIndexForNumber(int $discussionId, int $number, User $actor = null)

Get the position within a discussion where a post with a certain number is. If the post with that number does not exist, the index of the closest post to it will be returned.

Parameters

int $discussionId
int $number
User $actor

Return Value

int

protected Builder queryIds(array $ids, User $actor = null)

Parameters

array $ids
User $actor

Return Value

Builder