PHP Class BookStack\User

Inheritance: extends Model, implements Illuminate\Contracts\Auth\Authenticatable, implements Illuminate\Contracts\Auth\CanResetPassword, use trait Illuminate\Auth\Authenticatable, use trait Illuminate\Auth\Passwords\CanResetPassword, use trait Illuminate\Notifications\Notifiable
显示文件 Open project: ssddanbrown/bookstack Class Usage Examples

Protected Properties

Property Type Description
$fillable array The attributes that are mass assignable.
$hidden array The attributes excluded from the model's JSON form.
$permissions array This holds the user's permissions when loaded.
$table string The database table used by the model.

Public Methods

Method Description
attachRole ( Role $role ) Attach a role to this user.
attachRoleId ( $id ) Attach a role id to this user.
avatar ( ) : BelongsTo Get the avatar for the user.
can ( $permissionName ) : boolean Check if the user has a particular permission.
getAvatar ( integer $size = 50 ) : string Returns the user's avatar,
getDefault ( ) : User Returns the default public user.
getEditUrl ( ) : string Get the url for editing this user.
getProfileUrl ( ) : mixed Get the url that links to this user's profile.
getShortName ( integer $chars = 8 ) : string Get a shortened version of the user's name.
hasRole ( $role ) : mixed Check if the user has a role.
hasSocialAccount ( boolean | string $socialDriver = false ) : boolean Check if the user has a social account, If a driver is passed it checks for that single account type.
isDefault ( ) : boolean Check if the user is the default public user.
permissions ( boolean $cache = true ) : Illuminate\Database\Eloquent\Relations\HasManyThrough Get all permissions belonging to a the current user.
roles ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany The roles that belong to the user.
sendPasswordResetNotification ( string $token ) : void Send the password reset notification.
socialAccounts ( ) : Illuminate\Database\Eloquent\Relations\HasMany Get the social account associated with this user.

Method Details

attachRole() public method

Attach a role to this user.
public attachRole ( Role $role )
$role Role

attachRoleId() public method

Attach a role id to this user.
public attachRoleId ( $id )
$id

avatar() public method

Get the avatar for the user.
public avatar ( ) : BelongsTo
return Illuminate\Database\Eloquent\Relations\BelongsTo

can() public method

Check if the user has a particular permission.
public can ( $permissionName ) : boolean
$permissionName
return boolean

getAvatar() public method

Returns the user's avatar,
public getAvatar ( integer $size = 50 ) : string
$size integer
return string

getDefault() public static method

Returns the default public user.
public static getDefault ( ) : User
return User

getEditUrl() public method

Get the url for editing this user.
public getEditUrl ( ) : string
return string

getProfileUrl() public method

Get the url that links to this user's profile.
public getProfileUrl ( ) : mixed
return mixed

getShortName() public method

Get a shortened version of the user's name.
public getShortName ( integer $chars = 8 ) : string
$chars integer
return string

hasRole() public method

Check if the user has a role.
public hasRole ( $role ) : mixed
$role
return mixed

hasSocialAccount() public method

Check if the user has a social account, If a driver is passed it checks for that single account type.
public hasSocialAccount ( boolean | string $socialDriver = false ) : boolean
$socialDriver boolean | string
return boolean

isDefault() public method

Check if the user is the default public user.
public isDefault ( ) : boolean
return boolean

permissions() public method

Get all permissions belonging to a the current user.
public permissions ( boolean $cache = true ) : Illuminate\Database\Eloquent\Relations\HasManyThrough
$cache boolean
return Illuminate\Database\Eloquent\Relations\HasManyThrough

roles() public method

The roles that belong to the user.
public roles ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
return Illuminate\Database\Eloquent\Relations\BelongsToMany

sendPasswordResetNotification() public method

Send the password reset notification.
public sendPasswordResetNotification ( string $token ) : void
$token string
return void

socialAccounts() public method

Get the social account associated with this user.
public socialAccounts ( ) : Illuminate\Database\Eloquent\Relations\HasMany
return Illuminate\Database\Eloquent\Relations\HasMany

Property Details

$fillable protected_oe property

The attributes that are mass assignable.
protected array $fillable
return array

$hidden protected_oe property

The attributes excluded from the model's JSON form.
protected array $hidden
return array

$permissions protected_oe property

This holds the user's permissions when loaded.
protected array $permissions
return array

$table protected_oe property

The database table used by the model.
protected string $table
return string