class UserRepository

Methods

Builder
query()

Get a new query builder for the users table.

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

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

User
findOrFailByUsername($username, User $actor = null)

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

User|null
findByIdentification(string $identification)

Find a user by an identification (username or email).

User|null
findByEmail(string $email)

Find a user by email.

int|null
getIdForUsername(string $username, User $actor = null)

Get the ID of a user with the given username.

array
getIdsForUsername(string $string, User $actor = null)

Find users by matching a string of words against their username, optionally making sure they are visible to a certain user.

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

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

Details

Builder query()

Get a new query builder for the users table.

Return Value

Builder

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

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

Parameters

int $id
User $actor

Return Value

User

Exceptions

ModelNotFoundException

User findOrFailByUsername($username, User $actor = null)

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

Parameters

$username
User $actor

Return Value

User

Exceptions

ModelNotFoundException

User|null findByIdentification(string $identification)

Find a user by an identification (username or email).

Parameters

string $identification

Return Value

User|null

User|null findByEmail(string $email)

Find a user by email.

Parameters

string $email

Return Value

User|null

int|null getIdForUsername(string $username, User $actor = null)

Get the ID of a user with the given username.

Parameters

string $username
User $actor

Return Value

int|null

array getIdsForUsername(string $string, User $actor = null)

Find users by matching a string of words against their username, optionally making sure they are visible to a certain user.

Parameters

string $string
User $actor

Return Value

array

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

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

Parameters

Builder $query
User $actor

Return Value

Builder