PHP Класс Flarum\Core\User

Наследование: extends Flarum\Database\AbstractModel, use trait Flarum\Core\Support\EventGeneratorTrait, use trait Flarum\Core\Support\ScopeVisibilityTrait
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$dates
$gate Flarum\Core\Access\Gate The access gate.
$hasher Illuminate\Contracts\Hashing\Hasher The hasher with which to hash passwords.
$permissions string[] | null An array of permissions that this user has.
$preferences array - transformer: a callback that confines the value of the preference - default: a default value if the preference isn't set
$session Symfony\Component\HttpFoundation\Session\SessionInterface
$table

Открытые методы

Метод Описание
accessTokens ( ) : Illuminate\Database\Eloquent\Relations\HasMany Define the relationship with the user's access tokens.
activate ( ) Activate the user's account.
addPreference ( string $key, callable $transformer = null, mixed $default = null ) Register a preference with a transformer and a default value.
boot ( ) : void Boot the model.
can ( string $ability, array | mixed $arguments = [] ) : boolean
cannot ( string $ability, array | mixed $arguments = [] ) : boolean
changeAvatarPath ( string $path ) Change the path of the user avatar.
changeBio ( string $bio ) Change the user's bio.
changeEmail ( string $email ) Change the user's email.
changePassword ( string $password ) Change the user's password.
checkPassword ( string $password ) : boolean Check if a given password matches the user's password.
getAlertableNotificationTypes ( ) : array Get the notification types that should be alerted to this user, according to their preferences.
getAvatarUrlAttribute ( ) : string Get the URL of the user's avatar.
getGate ( ) : Flarum\Core\Access\Gate
getLocaleAttribute ( string $value ) : string Get the user's locale, falling back to the forum's default if they haven't set one.
getNewNotificationsCount ( ) : integer Get the number of new, unseen notifications for the user.
getNotificationPreferenceKey ( string $type, string $method ) : string Get the key for a preference which flags whether or not the user will receive a notification for $type via $method.
getPermissions ( ) : string[] Get a list of permissions that the user has.
getPreference ( string $key, mixed $default = null ) : mixed Get the value of a preference for this user.
getPreferencesAttribute ( string $value ) : array Get the values of all registered preferences for this user, by transforming their stored preferences and merging them with the defaults.
getSession ( ) : Symfony\Component\HttpFoundation\Session\SessionInterface
getUnreadNotificationsCount ( ) : integer Get the number of unread notifications for the user.
groups ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany Define the relationship with the user's groups.
hasPermission ( string $permission ) : boolean Check whether the user has a certain permission based on their groups.
hasPermissionLike ( string $match ) : boolean Check whether the user has a permission that is like the given string, based on their groups.
isAdmin ( ) : boolean Check whether or not the user is an administrator.
isGuest ( ) : boolean Check whether or not the user is a guest.
markAllAsRead ( ) Mark all discussions as read.
markNotificationsAsRead ( ) Mark all notifications as read.
notifications ( ) : Illuminate\Database\Eloquent\Relations\HasMany Define the relationship with the user's notifications.
permissions ( ) : Builder Define the relationship with the permissions of all of the groups that the user is in.
posts ( ) : Illuminate\Database\Eloquent\Relations\HasMany Define the relationship with the user's posts.
read ( ) : BelongsTo Define the relationship with the user's read discussions.
register ( string $username, string $email, string $password ) : static Register a new user.
rename ( string $username ) Rename the user.
requestEmailChange ( string $email ) Request that the user's email be changed.
setGate ( Flarum\Core\Access\Gate $gate )
setHasher ( Illuminate\Contracts\Hashing\Hasher $hasher ) Set the hasher with which to hash passwords.
setPasswordAttribute ( string $value ) Set the password attribute, storing it as a hash.
setPreference ( string $key, mixed $value ) Set the value of a preference for this user.
setPreferencesAttribute ( mixed $value ) Encode an array of preferences for storage in the database.
setSession ( Symfony\Component\HttpFoundation\Session\SessionInterface $session )
shouldAlert ( string $type ) : boolean Check whether or not the user should receive an alert for a notification type.
shouldEmail ( string $type ) : boolean Check whether or not the user should receive an email for a notification type.
updateLastSeen ( ) Set the user as being last seen just now.

Защищенные методы

Метод Описание
getUnreadNotifications ( ) : Illuminate\Database\Eloquent\Collection Get all notifications that have not been read yet.

Описание методов

accessTokens() публичный Метод

Define the relationship with the user's access tokens.
public accessTokens ( ) : Illuminate\Database\Eloquent\Relations\HasMany
Результат Illuminate\Database\Eloquent\Relations\HasMany

activate() публичный Метод

Activate the user's account.
public activate ( )

addPreference() публичный статический Метод

Register a preference with a transformer and a default value.
public static addPreference ( string $key, callable $transformer = null, mixed $default = null )
$key string
$transformer callable
$default mixed

boot() публичный статический Метод

Boot the model.
public static boot ( ) : void
Результат void

can() публичный Метод

public can ( string $ability, array | mixed $arguments = [] ) : boolean
$ability string
$arguments array | mixed
Результат boolean

cannot() публичный Метод

public cannot ( string $ability, array | mixed $arguments = [] ) : boolean
$ability string
$arguments array | mixed
Результат boolean

changeAvatarPath() публичный Метод

Change the path of the user avatar.
public changeAvatarPath ( string $path )
$path string

changeBio() публичный Метод

Change the user's bio.
public changeBio ( string $bio )
$bio string

changeEmail() публичный Метод

Change the user's email.
public changeEmail ( string $email )
$email string

changePassword() публичный Метод

Change the user's password.
public changePassword ( string $password )
$password string

checkPassword() публичный Метод

Check if a given password matches the user's password.
public checkPassword ( string $password ) : boolean
$password string
Результат boolean

getAlertableNotificationTypes() публичный Метод

Get the notification types that should be alerted to this user, according to their preferences.
public getAlertableNotificationTypes ( ) : array
Результат array

getAvatarUrlAttribute() публичный Метод

Get the URL of the user's avatar.
public getAvatarUrlAttribute ( ) : string
Результат string

getGate() публичный статический Метод

public static getGate ( ) : Flarum\Core\Access\Gate
Результат Flarum\Core\Access\Gate

getLocaleAttribute() публичный Метод

Get the user's locale, falling back to the forum's default if they haven't set one.
public getLocaleAttribute ( string $value ) : string
$value string
Результат string

getNewNotificationsCount() публичный Метод

Get the number of new, unseen notifications for the user.
public getNewNotificationsCount ( ) : integer
Результат integer

getNotificationPreferenceKey() публичный статический Метод

Get the key for a preference which flags whether or not the user will receive a notification for $type via $method.
public static getNotificationPreferenceKey ( string $type, string $method ) : string
$type string
$method string
Результат string

getPermissions() публичный Метод

Get a list of permissions that the user has.
public getPermissions ( ) : string[]
Результат string[]

getPreference() публичный Метод

Get the value of a preference for this user.
public getPreference ( string $key, mixed $default = null ) : mixed
$key string
$default mixed
Результат mixed

getPreferencesAttribute() публичный Метод

Get the values of all registered preferences for this user, by transforming their stored preferences and merging them with the defaults.
public getPreferencesAttribute ( string $value ) : array
$value string
Результат array

getSession() публичный Метод

public getSession ( ) : Symfony\Component\HttpFoundation\Session\SessionInterface
Результат Symfony\Component\HttpFoundation\Session\SessionInterface

getUnreadNotifications() защищенный Метод

Get all notifications that have not been read yet.
protected getUnreadNotifications ( ) : Illuminate\Database\Eloquent\Collection
Результат Illuminate\Database\Eloquent\Collection

getUnreadNotificationsCount() публичный Метод

Get the number of unread notifications for the user.
public getUnreadNotificationsCount ( ) : integer
Результат integer

groups() публичный Метод

Define the relationship with the user's groups.
public groups ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
Результат Illuminate\Database\Eloquent\Relations\BelongsToMany

hasPermission() публичный Метод

Check whether the user has a certain permission based on their groups.
public hasPermission ( string $permission ) : boolean
$permission string
Результат boolean

hasPermissionLike() публичный Метод

Check whether the user has a permission that is like the given string, based on their groups.
public hasPermissionLike ( string $match ) : boolean
$match string
Результат boolean

isAdmin() публичный Метод

Check whether or not the user is an administrator.
public isAdmin ( ) : boolean
Результат boolean

isGuest() публичный Метод

Check whether or not the user is a guest.
public isGuest ( ) : boolean
Результат boolean

markAllAsRead() публичный Метод

Mark all discussions as read.
public markAllAsRead ( )

markNotificationsAsRead() публичный Метод

Mark all notifications as read.

notifications() публичный Метод

Define the relationship with the user's notifications.
public notifications ( ) : Illuminate\Database\Eloquent\Relations\HasMany
Результат Illuminate\Database\Eloquent\Relations\HasMany

permissions() публичный Метод

Define the relationship with the permissions of all of the groups that the user is in.
public permissions ( ) : Builder
Результат Illuminate\Database\Eloquent\Builder

posts() публичный Метод

Define the relationship with the user's posts.
public posts ( ) : Illuminate\Database\Eloquent\Relations\HasMany
Результат Illuminate\Database\Eloquent\Relations\HasMany

read() публичный Метод

Define the relationship with the user's read discussions.
public read ( ) : BelongsTo
Результат Illuminate\Database\Eloquent\Relations\BelongsTo

register() публичный статический Метод

Register a new user.
public static register ( string $username, string $email, string $password ) : static
$username string
$email string
$password string
Результат static

rename() публичный Метод

Rename the user.
public rename ( string $username )
$username string

requestEmailChange() публичный Метод

Request that the user's email be changed.
public requestEmailChange ( string $email )
$email string

setGate() публичный статический Метод

public static setGate ( Flarum\Core\Access\Gate $gate )
$gate Flarum\Core\Access\Gate

setHasher() публичный статический Метод

Set the hasher with which to hash passwords.
public static setHasher ( Illuminate\Contracts\Hashing\Hasher $hasher )
$hasher Illuminate\Contracts\Hashing\Hasher

setPasswordAttribute() публичный Метод

Set the password attribute, storing it as a hash.
public setPasswordAttribute ( string $value )
$value string

setPreference() публичный Метод

Set the value of a preference for this user.
public setPreference ( string $key, mixed $value )
$key string
$value mixed

setPreferencesAttribute() публичный Метод

Encode an array of preferences for storage in the database.
public setPreferencesAttribute ( mixed $value )
$value mixed

setSession() публичный Метод

public setSession ( Symfony\Component\HttpFoundation\Session\SessionInterface $session )
$session Symfony\Component\HttpFoundation\Session\SessionInterface

shouldAlert() публичный Метод

Check whether or not the user should receive an alert for a notification type.
public shouldAlert ( string $type ) : boolean
$type string
Результат boolean

shouldEmail() публичный Метод

Check whether or not the user should receive an email for a notification type.
public shouldEmail ( string $type ) : boolean
$type string
Результат boolean

updateLastSeen() публичный Метод

Set the user as being last seen just now.
public updateLastSeen ( )

Описание свойств

$dates защищенное свойство

protected $dates

$gate защищенное статическое свойство

The access gate.
protected static Gate,Flarum\Core\Access $gate
Результат Flarum\Core\Access\Gate

$hasher защищенное статическое свойство

The hasher with which to hash passwords.
protected static Hasher,Illuminate\Contracts\Hashing $hasher
Результат Illuminate\Contracts\Hashing\Hasher

$permissions защищенное свойство

An array of permissions that this user has.
protected string[]|null $permissions
Результат string[] | null

$preferences защищенное статическое свойство

- transformer: a callback that confines the value of the preference - default: a default value if the preference isn't set
protected static array $preferences
Результат array

$session защищенное свойство

protected SessionInterface,Symfony\Component\HttpFoundation\Session $session
Результат Symfony\Component\HttpFoundation\Session\SessionInterface

$table защищенное свойство

protected $table