class Guest extends User
Traits
Constants
| LAST_SEEN_UPDATE_DIFF |
Difference from the current `last_seen` attribute value before `updateLastSeen()` will update the attribute on the DB. Measured in seconds. |
Properties
| bool | $timestamps | Indicates if the model should be timestamped. Turn off by default. | from AbstractModel |
|
| protected callable[] | $afterSaveCallbacks | An array of callbacks to be run once after the model is saved. | from AbstractModel |
|
| protected callable[] | $afterDeleteCallbacks | An array of callbacks to be run once after the model is deleted. | from AbstractModel |
|
| static array | $customCasts | from AbstractModel |
|
|
| static array | $defaults | from AbstractModel |
|
|
| protected string|null | $tableAlias | An alias for the table name, used in queries. | from AbstractModel |
|
| string[]|null | $uniqueKeys | If a model has unique keys, they should be defined here. | from AbstractModel |
|
| protected array | $pendingEvents | from EventGeneratorTrait |
|
|
| static protected array | $visibilityScopers | from ScopeVisibilityTrait |
|
|
| protected | $casts | from User |
|
|
| protected string[]|null | $permissions | An array of permissions that this user has. | from User |
|
| static protected callable[] | $groupProcessors | An array of callables, through each of which the user's list of groups is passed before being returned. | from User |
|
| array | $preferences | from User |
|
|
| static protected DriverInterface | $displayNameDriver | A driver for getting display names. | from User |
|
| static protected DriverInterface | $avatarDriver | A driver for getting avatar URLs. | from User |
|
| static protected Hasher | $hasher | The hasher with which to hash passwords. | from User |
|
| static protected Gate | $gate | The access gate. | from User |
|
| static protected callable[] | $passwordCheckers | Callbacks to check passwords. | from User |
|
| int | $id | Override the ID of this user, as a guest does not have an ID. |
|
|
| 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
Register a callback to be run once after the model is saved.
Register a callback to be run once after the model is deleted.
No description
Scope a query to only include records that are visible to a user.
Set the password attribute, storing it as a hash.
Determine whether the user has uploaded a custom avatar.
Check whether the user has a permission that is like the given string, based on their groups.
Get the notification types that should be alerted to this user, according to their preferences.
Get the values of all registered preferences for this user, by transforming their stored preferences and merging them with the defaults.
Encode an array of preferences for storage in the database.
Check whether the user should receive an alert for a notification type.
Check whether the user should receive an email for a notification type.
Ensure the current user is allowed to do something.
Define the relationship with the permissions of all the groups that the user is in.
Register a preference with a transformer and a default value.
Register a callback that processes a user's list of groups.
Get the key for a preference which flags whether the user will receive a notification for $type via $method.
Set the value of a notification preference.
Details
in AbstractModel
at
line 88
__construct(array $attributes = [])
in AbstractModel
at
line 103
array
getCasts()
in AbstractModel
at
line 117
void
afterSave(callable $callback)
Register a callback to be run once after the model is saved.
in AbstractModel
at
line 125
void
afterDelete(callable $callback)
Register a callback to be run once after the model is deleted.
in AbstractModel
at
line 133
array
releaseAfterSaveCallbacks()
in AbstractModel
at
line 145
array
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 157
newModelQuery()
in AbstractModel
at
line 169
qualifyColumn($column)
in AbstractModel
at
line 178
mixed
withTableAlias(callable $callback)
in AbstractModel
at
line 191
Collection
newCollection(array $models = [])
in AbstractModel
at
line 197
__sleep()
in EventGeneratorTrait
at
line 16
void
raise(object $event)
in EventGeneratorTrait
at
line 24
array
releaseEvents()
Return and reset all pending events.
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')
Scope a query to only include records that are visible to a user.
in ScopeVisibilityTrait
at
line 19
static Builder
whereVisibleTo(User $user)
static void
setDisplayNameDriver(DriverInterface $driver)
static void
setAvatarDriver(DriverInterface $driver)
Set the avatar driver.
void
setPasswordAttribute(string|null $value)
Set the password attribute, storing it as a hash.
bool
getHasUploadedAvatarAttribute()
Determine whether the user has uploaded a custom avatar.
bool
hasPermissionLike(string $match)
Check whether the user has a permission that is like the given string, based on their groups.
array
getAlertableNotificationTypes()
Get the notification types that should be alerted to this user, according to their preferences.
int
getNewNotificationCount()
Get the number of new, unseen notifications for the user.
array
getPreferencesAttribute(string|null $value)
Get the values of all registered preferences for this user, by transforming their stored preferences and merging them with the defaults.
void
setPreferencesAttribute(array $value)
Encode an array of preferences for storage in the database.
bool
shouldAlert(string $type)
Check whether the user should receive an alert for a notification type.
bool
shouldEmail(string $type)
Check whether the user should receive an email for a notification type.
at
line 36
bool
isGuest()
Check whether the user is a guest.
void
assertPermission(bool $condition)
Ensure the current user is allowed to do something.
If the condition is not met, an exception will be thrown that signals the lack of permissions. This is about *authorization*, i.e. retrying such a request / operation without a change in permissions (or using another user account) is pointless.
void
assertRegistered()
Ensure the given actor is authenticated.
This will throw an exception for guest users, signaling that *authorization* failed. Thus, they could retry the operation after logging in (or using other means of authentication).
Builder
permissions()
Define the relationship with the permissions of all the groups that the user is in.
static void
setHasher(Hasher $hasher)
Set the hasher with which to hash passwords.
static void
registerPreference(string $key, callable|null $transformer = null, mixed $default = null)
Register a preference with a transformer and a default value.
static void
addGroupProcessor(callable $callback)
Register a callback that processes a user's list of groups.
static string
getNotificationPreferenceKey(string $type, string $method)
Get the key for a preference which flags whether the user will receive a notification for $type via $method.
User
setNotificationPreference(string $type, string $method, bool $value)
Set the value of a notification preference.
at
line 27
Collection
getGroupsAttribute()
Get the guest's group, containing only the 'guests' group model.