class Guest extends User

Traits

Properties

bool $timestamps <p>Indicates if the model should be timestamped. Turn off by default.</p> from AbstractModel
protected callable[] $afterSaveCallbacks <p>An array of callbacks to be run once after the model is saved.</p> from AbstractModel
protected callable[] $afterDeleteCallbacks <p>An array of callbacks to be run once after the model is deleted.</p> from AbstractModel
protected array $pendingEvents from EventGeneratorTrait
protected $table <p>{@inheritdoc}</p> from User
protected $dates <p>{@inheritdoc}</p> from User
protected string[]|null $permissions <p>An array of permissions that this user has.</p> from User
array $preferences from User
static protected Hasher $hasher <p>The hasher with which to hash passwords.</p> from User
static protected Gate $gate <p>The access gate.</p> from User
int $id <p>Override the ID of this user, as a guest does not have an ID.</p>
string $username from User
string $email from User
bool $is_activated from User
string $password from User
string $locale from User
string $bio from User
string|null $avatar_path from User
string $avatar_url from User
Carbon|null $join_time from User
Carbon|null $last_seen_time from User
Carbon|null $read_time from User
Carbon|null $notifications_read_time from User
int $discussions_count from User
int $comments_count from User

Methods

static 
boot()

<p>Boot the model.</p>

from User
array
getDates()

<p>Get the attributes that should be converted to dates.</p>

mixed
getAttribute(string $key)

<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>

mixed
getCustomRelation(string $name)

<p>Get a custom relation object.</p>

void
afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

void
afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

callable[]
releaseAfterSaveCallbacks()

No description

callable[]
releaseAfterDeleteCallbacks()

No description

__call($method, $arguments)

<p>{@inheritdoc}</p>

raise(mixed $event)

<p>Raise a new event.</p>

array
releaseEvents()

<p>Return and reset all pending events.</p>

scopeWhereVisibleTo(Builder $query, User $actor)

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

static User
register(string $username, string $email, string $password)

<p>Register a new user.</p>

from User
static Gate
getGate()

No description

from User
static 
setGate(Gate $gate)

No description

from User
$this
rename(string $username)

<p>Rename the user.</p>

from User
$this
changeEmail(string $email)

<p>Change the user's email.</p>

from User
$this
requestEmailChange(string $email)

<p>Request that the user's email be changed.</p>

from User
$this
changePassword(string $password)

<p>Change the user's password.</p>

from User
setPasswordAttribute(string $value)

<p>Set the password attribute, storing it as a hash.</p>

from User
$this
changeBio(string $bio)

<p>Change the user's bio.</p>

from User
$this
markAllAsRead()

<p>Mark all discussions as read.</p>

from User
$this
markNotificationsAsRead()

<p>Mark all notifications as read.</p>

from User
$this
changeAvatarPath(string $path)

<p>Change the path of the user avatar.</p>

from User
string
getAvatarUrlAttribute()

<p>Get the URL of the user's avatar.</p>

from User
string
getLocaleAttribute(string $value)

<p>Get the user's locale, falling back to the forum's default if they haven't set one.</p>

from User
bool
checkPassword(string $password)

<p>Check if a given password matches the user's password.</p>

from User
$this
activate()

<p>Activate the user's account.</p>

from User
bool
hasPermission(string $permission)

<p>Check whether the user has a certain permission based on their groups.</p>

from User
bool
hasPermissionLike(string $match)

<p>Check whether the user has a permission that is like the given string, based on their groups.</p>

from User
array
getAlertableNotificationTypes()

<p>Get the notification types that should be alerted to this user, according to their preferences.</p>

from User
int
getUnreadNotificationsCount()

<p>Get the number of unread notifications for the user.</p>

from User
Collection
getUnreadNotifications()

<p>Get all notifications that have not been read yet</p>

from User
int
getNewNotificationsCount()

<p>Get the number of new, unseen notifications for the user.</p>

from User
array
getPreferencesAttribute(string $value)

<p>Get the values of all registered preferences for this user, by transforming their stored preferences and merging them with the defaults.</p>

from User
setPreferencesAttribute(mixed $value)

<p>Encode an array of preferences for storage in the database.</p>

from User
bool
shouldAlert(string $type)

<p>Check whether or not the user should receive an alert for a notification type.</p>

from User
bool
shouldEmail(string $type)

<p>Check whether or not the user should receive an email for a notification type.</p>

from User
mixed
getPreference(string $key, mixed $default = null)

<p>Get the value of a preference for this user.</p>

from User
$this
setPreference(string $key, mixed $value)

<p>Set the value of a preference for this user.</p>

from User
$this
updateLastSeen()

<p>Set the user as being last seen just now.</p>

from User
bool
isAdmin()

<p>Check whether or not the user is an administrator.</p>

from User
bool
isGuest()

<p>Check whether or not the user is a guest.</p>

HasMany
posts()

<p>Define the relationship with the user's posts.</p>

from User
BelongsTo
read()

<p>Define the relationship with the user's read discussions.</p>

from User
BelongsToMany
groups()

<p>Define the relationship with the user's groups.</p>

from User
HasMany
notifications()

<p>Define the relationship with the user's notifications.</p>

from User
Builder
permissions()

<p>Define the relationship with the permissions of all of the groups that the user is in.</p>

from User
string[]
getPermissions()

<p>Get a list of permissions that the user has.</p>

from User
HasMany
accessTokens()

<p>Define the relationship with the user's access tokens.</p>

from User
bool
can(string $ability, array|mixed $arguments = [])

No description

from User
bool
cannot(string $ability, array|mixed $arguments = [])

No description

from User
static 
setHasher(Hasher $hasher)

<p>Set the hasher with which to hash passwords.</p>

from User
static 
addPreference(string $key, callable $transformer = null, mixed $default = null)

<p>Register a preference with a transformer and a default value.</p>

from User
static string
getNotificationPreferenceKey(string $type, string $method)

<p>Get the key for a preference which flags whether or not the user will receive a notification for $type via $method.</p>

from User
Group
getGroupsAttribute()

<p>Get the guest's group, containing only the 'guests' group model.</p>

Details

static boot()

<p>Boot the model.</p>

array getDates()

<p>Get the attributes that should be converted to dates.</p>

Return Value

array

mixed getAttribute(string $key)

<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>

Parameters

string $key

Return Value

mixed

protected mixed getCustomRelation(string $name)

<p>Get a custom relation object.</p>

Parameters

string $name

Return Value

mixed

void afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

Parameters

callable $callback

Return Value

void

void afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

Parameters

callable $callback

Return Value

void

callable[] releaseAfterSaveCallbacks()

Return Value

callable[]

callable[] releaseAfterDeleteCallbacks()

Return Value

callable[]

__call($method, $arguments)

<p>{@inheritdoc}</p>

Parameters

$method
$arguments

raise(mixed $event)

<p>Raise a new event.</p>

Parameters

mixed $event

array releaseEvents()

<p>Return and reset all pending events.</p>

Return Value

array

scopeWhereVisibleTo(Builder $query, User $actor)

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

Parameters

Builder $query
User $actor

static User register(string $username, string $email, string $password)

<p>Register a new user.</p>

Parameters

string $username
string $email
string $password

Return Value

User

static Gate getGate()

Return Value

Gate

static setGate(Gate $gate)

Parameters

Gate $gate

$this rename(string $username)

<p>Rename the user.</p>

Parameters

string $username

Return Value

$this

$this changeEmail(string $email)

<p>Change the user's email.</p>

Parameters

string $email

Return Value

$this

$this requestEmailChange(string $email)

<p>Request that the user's email be changed.</p>

Parameters

string $email

Return Value

$this

$this changePassword(string $password)

<p>Change the user's password.</p>

Parameters

string $password

Return Value

$this

setPasswordAttribute(string $value)

<p>Set the password attribute, storing it as a hash.</p>

Parameters

string $value

$this changeBio(string $bio)

<p>Change the user's bio.</p>

Parameters

string $bio

Return Value

$this

$this markAllAsRead()

<p>Mark all discussions as read.</p>

Return Value

$this

$this markNotificationsAsRead()

<p>Mark all notifications as read.</p>

Return Value

$this

$this changeAvatarPath(string $path)

<p>Change the path of the user avatar.</p>

Parameters

string $path

Return Value

$this

string getAvatarUrlAttribute()

<p>Get the URL of the user's avatar.</p>

Return Value

string

string getLocaleAttribute(string $value)

<p>Get the user's locale, falling back to the forum's default if they haven't set one.</p>

Parameters

string $value

Return Value

string

bool checkPassword(string $password)

<p>Check if a given password matches the user's password.</p>

Parameters

string $password

Return Value

bool

$this activate()

<p>Activate the user's account.</p>

Return Value

$this

bool hasPermission(string $permission)

<p>Check whether the user has a certain permission based on their groups.</p>

Parameters

string $permission

Return Value

bool

bool hasPermissionLike(string $match)

<p>Check whether the user has a permission that is like the given string, based on their groups.</p>

Parameters

string $match

Return Value

bool

array getAlertableNotificationTypes()

<p>Get the notification types that should be alerted to this user, according to their preferences.</p>

Return Value

array

int getUnreadNotificationsCount()

<p>Get the number of unread notifications for the user.</p>

Return Value

int

protected Collection getUnreadNotifications()

<p>Get all notifications that have not been read yet</p>

Return Value

Collection

int getNewNotificationsCount()

<p>Get the number of new, unseen notifications for the user.</p>

Return Value

int

array getPreferencesAttribute(string $value)

<p>Get the values of all registered preferences for this user, by transforming their stored preferences and merging them with the defaults.</p>

Parameters

string $value

Return Value

array

setPreferencesAttribute(mixed $value)

<p>Encode an array of preferences for storage in the database.</p>

Parameters

mixed $value

bool shouldAlert(string $type)

<p>Check whether or not the user should receive an alert for a notification type.</p>

Parameters

string $type

Return Value

bool

bool shouldEmail(string $type)

<p>Check whether or not the user should receive an email for a notification type.</p>

Parameters

string $type

Return Value

bool

mixed getPreference(string $key, mixed $default = null)

<p>Get the value of a preference for this user.</p>

Parameters

string $key
mixed $default

Return Value

mixed

$this setPreference(string $key, mixed $value)

<p>Set the value of a preference for this user.</p>

Parameters

string $key
mixed $value

Return Value

$this

$this updateLastSeen()

<p>Set the user as being last seen just now.</p>

Return Value

$this

bool isAdmin()

<p>Check whether or not the user is an administrator.</p>

Return Value

bool

bool isGuest()

<p>Check whether or not the user is a guest.</p>

Return Value

bool

HasMany posts()

<p>Define the relationship with the user's posts.</p>

Return Value

HasMany

BelongsTo read()

<p>Define the relationship with the user's read discussions.</p>

Return Value

BelongsTo

BelongsToMany groups()

<p>Define the relationship with the user's groups.</p>

Return Value

BelongsToMany

HasMany notifications()

<p>Define the relationship with the user's notifications.</p>

Return Value

HasMany

Builder permissions()

<p>Define the relationship with the permissions of all of the groups that the user is in.</p>

Return Value

Builder

string[] getPermissions()

<p>Get a list of permissions that the user has.</p>

Return Value

string[]

HasMany accessTokens()

<p>Define the relationship with the user's access tokens.</p>

Return Value

HasMany

bool can(string $ability, array|mixed $arguments = [])

Parameters

string $ability
array|mixed $arguments

Return Value

bool

bool cannot(string $ability, array|mixed $arguments = [])

Parameters

string $ability
array|mixed $arguments

Return Value

bool

static setHasher(Hasher $hasher)

<p>Set the hasher with which to hash passwords.</p>

Parameters

Hasher $hasher

static addPreference(string $key, callable $transformer = null, mixed $default = null)

<p>Register a preference with a transformer and a default value.</p>

Parameters

string $key
callable $transformer
mixed $default

static string getNotificationPreferenceKey(string $type, string $method)

<p>Get the key for a preference which flags whether or not the user will receive a notification for $type via $method.</p>

Parameters

string $type
string $method

Return Value

string

Group getGroupsAttribute()

<p>Get the guest's group, containing only the 'guests' group model.</p>

Return Value

Group