PHP Class Flarum\Core\Repository\PostRepository

显示文件 Open project: flarum/core Class Usage Examples

Public Methods

Method Description
filterVisibleIds ( array $ids, User $actor ) : array Filter a list of post IDs to only include posts that are visible to a certain user.
findByIds ( array $ids, User $actor = null ) : Illuminate\Database\Eloquent\Collection Find posts by their IDs, optionally making sure they are visible to a certain user.
findOrFail ( integer $id, User $actor = null ) : Post Find a post by ID, optionally making sure it is visible to a certain user, or throw an exception.
findWhere ( array $where = [], User $actor = null, array $sort = [], integer $count = null, integer $start ) : Illuminate\Database\Eloquent\Collection Find posts that match certain conditions, optionally making sure they are visible to a certain user, and/or using other criteria.
getIndexForNumber ( integer $discussionId, integer $number, User $actor = null ) : integer 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.
query ( ) : Builder Get a new query builder for the posts table.

Protected Methods

Method Description
getDiscussionsForPosts ( $postIds, User $actor ) : mixed
queryIds ( array $ids, User $actor = null ) : mixed

Method Details

filterVisibleIds() public method

Filter a list of post IDs to only include posts that are visible to a certain user.
public filterVisibleIds ( array $ids, User $actor ) : array
$ids array
$actor Flarum\Core\User
return array

findByIds() public method

Find posts by their IDs, optionally making sure they are visible to a certain user.
public findByIds ( array $ids, User $actor = null ) : Illuminate\Database\Eloquent\Collection
$ids array
$actor Flarum\Core\User
return Illuminate\Database\Eloquent\Collection

findOrFail() public method

Find a post by ID, optionally making sure it is visible to a certain user, or throw an exception.
public findOrFail ( integer $id, User $actor = null ) : Post
$id integer
$actor Flarum\Core\User
return Flarum\Core\Post

findWhere() public method

Find posts that match certain conditions, optionally making sure they are visible to a certain user, and/or using other criteria.
public findWhere ( array $where = [], User $actor = null, array $sort = [], integer $count = null, integer $start ) : Illuminate\Database\Eloquent\Collection
$where array
$actor Flarum\Core\User
$sort array
$count integer
$start integer
return Illuminate\Database\Eloquent\Collection

getDiscussionsForPosts() protected method

protected getDiscussionsForPosts ( $postIds, User $actor ) : mixed
$postIds
$actor Flarum\Core\User
return mixed

getIndexForNumber() public method

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.
public getIndexForNumber ( integer $discussionId, integer $number, User $actor = null ) : integer
$discussionId integer
$number integer
$actor Flarum\Core\User
return integer

query() public method

Get a new query builder for the posts table.
public query ( ) : Builder
return Illuminate\Database\Eloquent\Builder

queryIds() protected method

protected queryIds ( array $ids, User $actor = null ) : mixed
$ids array
$actor Flarum\Core\User
return mixed