class PostRepository

Methods

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

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

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

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

Collection
findByIds(array $ids, User $actor = null)

<p>Find posts by their IDs, optionally making sure they are visible to a certain user.</p>

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

<p>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.</p>

getDiscussionsForPosts($postIds, User $actor)

No description

Details

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

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

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)

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

Parameters

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

Return Value

Collection

Collection findByIds(array $ids, User $actor = null)

<p>Find posts by their IDs, optionally making sure they are visible to a certain user.</p>

Parameters

array $ids
User $actor

Return Value

Collection

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

<p>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.</p>

Parameters

int $discussionId
int $number
User $actor

Return Value

int

protected getDiscussionsForPosts($postIds, User $actor)

Parameters

$postIds
User $actor