class UserRepository

Methods

Builder
query()

<p>Get a new query builder for the users table.</p>

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

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

findOrFailByUsername($username, User $actor = null)

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

User|null
findByIdentification(string $identification)

<p>Find a user by an identification (username or email).</p>

User|null
findByEmail(string $email)

<p>Find a user by email.</p>

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

<p>Get the ID of a user with the given username.</p>

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

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

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

<p>Scope a query to only include records that are visible to a user.</p>

Details

Builder query()

<p>Get a new query builder for the users table.</p>

Return Value

Builder

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

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

Parameters

int $id
User $actor

Return Value

User

Exceptions

ModelNotFoundException

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

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

Parameters

$username
User $actor

Return Value

User

Exceptions

ModelNotFoundException

User|null findByIdentification(string $identification)

<p>Find a user by an identification (username or email).</p>

Parameters

string $identification

Return Value

User|null

User|null findByEmail(string $email)

<p>Find a user by email.</p>

Parameters

string $email

Return Value

User|null

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

<p>Get the ID of a user with the given username.</p>

Parameters

string $username
User $actor

Return Value

int|null

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

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

Parameters

string $string
User $actor

Return Value

array

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

<p>Scope a query to only include records that are visible to a user.</p>

Parameters

Builder $query
User $actor

Return Value

Builder