class DiscussionRepository

Methods

Builder
query()

Get a new query builder for the discussions table.

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

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

array
getReadIds(User $user)

Get the IDs of discussions which a user has read completely.

Builder
scopeVisibleTo(Builder $query, User $user = null)

Scope a query to only include records that are visible to a user.

Details

Builder query()

Get a new query builder for the discussions table.

Return Value

Builder

Discussion findOrFail(int $id, User $user = null)

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

Parameters

int $id
User $user

Return Value

Discussion

array getReadIds(User $user)

Get the IDs of discussions which a user has read completely.

Parameters

User $user

Return Value

array

protected Builder scopeVisibleTo(Builder $query, User $user = null)

Scope a query to only include records that are visible to a user.

Parameters

Builder $query
User $user

Return Value

Builder