class Guest extends User
Traits
Constants
LAST_SEEN_UPDATE_DIFF |
<p>Difference from the current <code>last_seen</code> attribute value before <code>updateLastSeen()</code> will update the attribute on the DB. Measured in seconds.</p> |
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 | $customCasts | from AbstractModel | ||
static | $defaults | from AbstractModel | ||
protected | $tableAlias | <p>An alias for the table name, used in queries.</p> | from AbstractModel | |
protected | $pendingEvents | from EventGeneratorTrait | ||
static protected | $visibilityScopers | from ScopeVisibilityTrait | ||
protected | $casts | from User | ||
protected string[]|null | $permissions | <p>An array of permissions that this user has.</p> | from User | |
static protected callable[] | $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 | $displayNameDriver | <p>A driver for getting display names.</p> | from User | |
static protected | $hasher | <p>The hasher with which to hash passwords.</p> | from User | |
static protected | $gate | <p>The access gate.</p> | from User | |
static protected callable[] | $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 | ||
Group> | $groups | from User | ||
Group> | $visibleGroups | from User | ||
Notification> | $notifications | from User | ||
AccessToken> | $accessTokens | from User | ||
Post> | $posts | from User | ||
Discussion> | $discussions | from User | ||
Discussion> | $read | from User | ||
Notification> | $unreadNotifications | from User | ||
LoginProvider> | $loginProviders | from User | ||
EmailToken> | $emailTokens | from User | ||
PasswordToken> | $passwordTokens | 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>
No description
<p>Scope a query to only include records that are visible to a user.</p>
No description
<p>Set the password attribute, storing it as a hash.</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 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 the user should receive an alert for a notification type.</p>
<p>Check whether the user should receive an email for a notification type.</p>
<p>Ensure the current user is allowed to do something.</p>
<p>Define the relationship with the permissions of all 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 the user will receive a notification for $type via $method.</p>
<p>Set the value of a notification preference.</p>
<p>Get the guest's group, containing only the 'guests' group model.</p>
Details
in AbstractModel
at
line 88
__construct(array $attributes = [])
in AbstractModel
at
line 103
array
getCasts()
in AbstractModel
at
line 118
getAttribute($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 143
protected mixed
getCustomRelation(string $name)
<p>Get a custom relation object.</p>
in AbstractModel
at
line 158
void
afterSave(callable $callback)
<p>Register a callback to be run once after the model is saved.</p>
in AbstractModel
at
line 166
void
afterDelete(callable $callback)
<p>Register a callback to be run once after the model is deleted.</p>
in AbstractModel
at
line 174
array
releaseAfterSaveCallbacks()
in AbstractModel
at
line 186
array
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 195
__call($method, $parameters)
in AbstractModel
at
line 204
newModelQuery()
in AbstractModel
at
line 215
qualifyColumn($column)
in AbstractModel
at
line 224
mixed
withTableAlias(callable $callback)
in AbstractModel
at
line 236
Collection
newCollection(array $models = [])
in AbstractModel
at
line 241
__sleep()
in EventGeneratorTrait
at
line 16
void
raise(object $event)
in EventGeneratorTrait
at
line 24
array
releaseEvents()
<p>Return and reset all pending events.</p>
in ScopeVisibilityTrait
at
line 28
static void
registerVisibilityScoper(callable $scoper, string|null $ability = null)
in ScopeVisibilityTrait
at
line 44
Builder
scopeWhereVisibleTo(Builder $query, User $actor, string $ability = 'view')
<p>Scope a query to only include records that are visible to a user.</p>
in ScopeVisibilityTrait
at
line 19
static Builder
whereVisibleTo(User $user)
static User
register(string|null $username, string|null $email, string|null $password)
static void
setDisplayNameDriver(DriverInterface $driver)
void
setPasswordAttribute(string|null $value)
<p>Set the password attribute, storing it as a hash.</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
getNewNotificationCount()
<p>Get the number of new, unseen notifications for the user.</p>
array
getPreferencesAttribute(string|null $value)
<p>Get the values of all registered preferences for this user, by transforming their stored preferences and merging them with the defaults.</p>
void
setPreferencesAttribute(array $value)
<p>Encode an array of preferences for storage in the database.</p>
bool
shouldAlert(string $type)
<p>Check whether the user should receive an alert for a notification type.</p>
bool
shouldEmail(string $type)
<p>Check whether the user should receive an email for a notification type.</p>
at
line 36
bool
isGuest()
<p>Check whether the user is a guest.</p>
void
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>
void
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>
Builder
permissions()
<p>Define the relationship with the permissions of all the groups that the user is in.</p>
static void
setHasher(Hasher $hasher)
<p>Set the hasher with which to hash passwords.</p>
static void
registerPreference(string $key, callable $transformer = null, mixed $default = null)
<p>Register a preference with a transformer and a default value.</p>
static void
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 the user will receive a notification for $type via $method.</p>
User
setNotificationPreference(string $type, string $method, bool $value)
<p>Set the value of a notification preference.</p>
at
line 27
Collection
getGroupsAttribute()
<p>Get the guest's group, containing only the 'guests' group model.</p>