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 | |
static | $customRelations | from AbstractModel | ||
static | $dateAttributes | from AbstractModel | ||
static | $defaults | from AbstractModel | ||
protected array | $pendingEvents | from EventGeneratorTrait | ||
static protected | $visibilityScopers | from ScopeVisibilityTrait | ||
protected array | $dates | <p>The attributes that should be mutated to dates.</p> | from User | |
protected string[]|null | $permissions | <p>An array of permissions that this user has.</p> | from User | |
static protected | $groupProcessors | <p>An array of callables, through each of which the user's list of groups is passed before being returned.</p> | from User | |
array | $preferences | from User | ||
static protected DriverInterface | $displayNameDriver | <p>A driver for getting display names.</p> | 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 | |
static protected array | $passwordCheckers | <p>Callbacks to check passwords.</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 | $display_name | from User | ||
string | from User | |||
bool | $is_email_confirmed | from User | ||
string | $password | from User | ||
string|null | $avatar_url | from User | ||
Carbon|null | $joined_at | from User | ||
Carbon|null | $last_seen_at | from User | ||
Carbon|null | $marked_all_as_read_at | from User | ||
Carbon|null | $read_notifications_at | from User | ||
int | $discussion_count | from User | ||
int | $comment_count | from User |
Methods
<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>
<p>Register a callback to be run once after the model is saved.</p>
<p>Register a callback to be run once after the model is deleted.</p>
<p>Scope a query to only include records that are visible to a user.</p>
<p>Register a new user.</p>
<p>Set the password attribute, storing it as a hash.</p>
<p>Get the URL of the user's avatar.</p>
<p>Check if a given password matches the user's password.</p>
<p>Check whether the user has a certain permission based on their groups.</p>
<p>Check whether the user has a permission that is like the given string, based on their groups.</p>
<p>Get the notification types that should be alerted to this user, according to their preferences.</p>
<p>Get the number of unread notifications for the user.</p>
<p>Get all notifications that have not been read yet.</p>
<p>Get the number of new, unseen notifications for the user.</p>
<p>Get the values of all registered preferences for this user, by transforming their stored preferences and merging them with the defaults.</p>
<p>Encode an array of preferences for storage in the database.</p>
<p>Check whether or not the user should receive an alert for a notification type.</p>
<p>Check whether or not the user should receive an email for a notification type.</p>
<p>Get the value of a preference for this user.</p>
<p>Set the value of a preference for this user.</p>
<p>Ensure the current user is allowed to do something.</p>
<p>Define the relationship with the permissions of all of the groups that the user is in.</p>
<p>Register a preference with a transformer and a default value.</p>
<p>Register a callback that processes a user's list of groups.</p>
<p>Get the key for a preference which flags whether or not the user will receive a notification for $type via $method.</p>
Details
in AbstractModel
at
line 85
__construct(array $attributes = [])
<p>{@inheritdoc}</p>
in AbstractModel
at
line 105
array
getDates()
<p>Get the attributes that should be converted to dates.</p>
in AbstractModel
at
line 123
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>
in AbstractModel
at
line 149
protected mixed
getCustomRelation(string $name)
<p>Get a custom relation object.</p>
in AbstractModel
at
line 165
void
afterSave(callable $callback)
<p>Register a callback to be run once after the model is saved.</p>
in AbstractModel
at
line 176
void
afterDelete(callable $callback)
<p>Register a callback to be run once after the model is deleted.</p>
in AbstractModel
at
line 184
callable[]
releaseAfterSaveCallbacks()
in AbstractModel
at
line 196
callable[]
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 208
__call($method, $arguments)
<p>{@inheritdoc}</p>
in EventGeneratorTrait
at
line 24
raise(mixed $event)
<p>Raise a new event.</p>
in EventGeneratorTrait
at
line 34
array
releaseEvents()
<p>Return and reset all pending events.</p>
in ScopeVisibilityTrait
at
line 20
static
registerVisibilityScoper($scoper, $ability = null)
in ScopeVisibilityTrait
at
line 41
scopeWhereVisibleTo(Builder $query, User $actor, string $ability = 'view')
<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>
static
setDisplayNameDriver(DriverInterface $driver)
<p>Set the display name driver.</p>
$this
requestEmailChange(string $email)
<p>Request that the user's email be changed.</p>
setPasswordAttribute(string $value)
<p>Set the password attribute, storing it as a hash.</p>
string
getAvatarUrlAttribute(string $value = null)
<p>Get the URL of the user's avatar.</p>
bool
checkPassword(string $password)
<p>Check if a given password matches the user's password.</p>
bool
hasPermission(string $permission)
<p>Check whether the user has a certain permission based on their groups.</p>
bool
hasPermissionLike(string $match)
<p>Check whether the user has a permission that is like the given string, based on their groups.</p>
array
getAlertableNotificationTypes()
<p>Get the notification types that should be alerted to this user, according to their preferences.</p>
int
getUnreadNotificationCount()
<p>Get the number of unread notifications for the user.</p>
protected Collection
getUnreadNotifications()
<p>Get all notifications that have not been read yet.</p>
int
getNewNotificationCount()
<p>Get the number of new, unseen notifications for the user.</p>
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>
setPreferencesAttribute(mixed $value)
<p>Encode an array of preferences for storage in the database.</p>
bool
shouldAlert(string $type)
<p>Check whether or not the user should receive an alert for a notification type.</p>
bool
shouldEmail(string $type)
<p>Check whether or not the user should receive an email for a notification type.</p>
mixed
getPreference(string $key, mixed $default = null)
<p>Get the value of a preference for this user.</p>
$this
setPreference(string $key, mixed $value)
<p>Set the value of a preference for this user.</p>
at
line 40
bool
isGuest()
<p>Check whether or not the user is a guest.</p>
assertPermission(bool $condition)
<p>Ensure the current user is allowed to do something.</p>
<p>If the condition is not met, an exception will be thrown that signals the lack of permissions. This is about <em>authorization</em>, i.e. retrying such a request / operation without a change in permissions (or using another user account) is pointless.</p>
assertRegistered()
<p>Ensure the given actor is authenticated.</p>
<p>This will throw an exception for guest users, signaling that <em>authorization</em> failed. Thus, they could retry the operation after logging in (or using other means of authentication).</p>
HasMany
discussions()
<p>Define the relationship with the user's discussions.</p>
BelongsTo
read()
<p>Define the relationship with the user's read discussions.</p>
HasMany
notifications()
<p>Define the relationship with the user's notifications.</p>
HasMany
emailTokens()
<p>Define the relationship with the user's email tokens.</p>
Builder
permissions()
<p>Define the relationship with the permissions of all of the groups that the user is in.</p>
HasMany
accessTokens()
<p>Define the relationship with the user's access tokens.</p>
static
setHasher(Hasher $hasher)
<p>Set the hasher with which to hash passwords.</p>
static
registerPreference(string $key, callable $transformer = null, mixed $default = null)
<p>Register a preference with a transformer and a default value.</p>
static array
addGroupProcessor(callable $callback)
<p>Register a callback that processes a user's list of groups.</p>
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>