PHP Class RainLab\User\Models\User

Inheritance: extends October\Rain\Auth\Models\User, use trait October\Rain\Database\Traits\SoftDeleting
显示文件 Open project: rainlab/user-plugin Class Usage Examples

Public Properties

Property Type Description
$attachOne
$belongsToMany Relations
$loginAttribute
$rules Validation rules

Protected Properties

Property Type Description
$dates
$fillable The attributes that are mass assignable.
$purgeable Purge attributes from data set.
$table The database table used by the model.

Public Methods

Method Description
afterCreate ( ) : void After create event
afterDelete ( ) : void After delete event
afterLogin ( ) : void After login event
attemptActivation ( string $code ) : void Sends the confirmation email to a user, after activating.
ban ( ) : void Ban this user, preventing them from signing in.
beforeValidate ( ) : void Before validation event
convertToRegistered ( $sendNotification = true ) : void Converts a guest user to a registered one and sends an invitation notification.
findByEmail ( $email ) : self Looks up a user by their email address.
getAvatarThumb ( $size = 25, $options = null ) Returns the public image file path to this user's avatar.
getLastSeen ( ) : Carbon\Carbon Returns the date this user was last seen.
getLoginName ( ) : string Returns the name for the user's login.
getPersistCode ( ) : string Gets a code for when the user is persisted to a cookie or session which identifies the user.
isBanned ( ) : boolean Check if the user is banned.
isOnline ( ) : boolean Returns true if the user has been active within the last 5 minutes.
scopeFilterByGroup ( $query, $filter )
scopeIsActivated ( $query )
touchLastSeen ( ) : void Checks if the user has been seen in the last 5 minutes, and if not, updates the last_seen timestamp to reflect their online status.
unban ( ) : void Remove the ban on this user.

Protected Methods

Method Description
generatePassword ( ) : void Assigns this user with a random password.
getNotificationVars ( ) : array Returns the variables available when sending a user notification.
sendInvitation ( ) : void Sends an invitation to the user using template "rainlab.user::mail.invite".

Method Details

afterCreate() public method

After create event
public afterCreate ( ) : void
return void

afterDelete() public method

After delete event
public afterDelete ( ) : void
return void

afterLogin() public method

After login event
public afterLogin ( ) : void
return void

attemptActivation() public method

Sends the confirmation email to a user, after activating.
public attemptActivation ( string $code ) : void
$code string
return void

ban() public method

Ban this user, preventing them from signing in.
public ban ( ) : void
return void

beforeValidate() public method

Before validation event
public beforeValidate ( ) : void
return void

convertToRegistered() public method

Converts a guest user to a registered one and sends an invitation notification.
public convertToRegistered ( $sendNotification = true ) : void
return void

findByEmail() public static method

Looks up a user by their email address.
public static findByEmail ( $email ) : self
return self

generatePassword() protected method

Assigns this user with a random password.
protected generatePassword ( ) : void
return void

getAvatarThumb() public method

Returns the public image file path to this user's avatar.
public getAvatarThumb ( $size = 25, $options = null )

getLastSeen() public method

Returns the date this user was last seen.
public getLastSeen ( ) : Carbon\Carbon
return Carbon\Carbon

getLoginName() public method

Returns the name for the user's login.
public getLoginName ( ) : string
return string

getNotificationVars() protected method

Returns the variables available when sending a user notification.
protected getNotificationVars ( ) : array
return array

getPersistCode() public method

Gets a code for when the user is persisted to a cookie or session which identifies the user.
public getPersistCode ( ) : string
return string

isBanned() public method

Check if the user is banned.
public isBanned ( ) : boolean
return boolean

isOnline() public method

Returns true if the user has been active within the last 5 minutes.
public isOnline ( ) : boolean
return boolean

scopeFilterByGroup() public method

public scopeFilterByGroup ( $query, $filter )

scopeIsActivated() public method

public scopeIsActivated ( $query )

sendInvitation() protected method

Sends an invitation to the user using template "rainlab.user::mail.invite".
protected sendInvitation ( ) : void
return void

touchLastSeen() public method

Checks if the user has been seen in the last 5 minutes, and if not, updates the last_seen timestamp to reflect their online status.
public touchLastSeen ( ) : void
return void

unban() public method

Remove the ban on this user.
public unban ( ) : void
return void

Property Details

$attachOne public_oe property

public $attachOne

$belongsToMany public_oe property

Relations
public $belongsToMany

$dates protected_oe property

protected $dates

$fillable protected_oe property

The attributes that are mass assignable.
protected $fillable

$loginAttribute public_oe static_oe property

public static $loginAttribute

$purgeable protected_oe property

Purge attributes from data set.
protected $purgeable

$rules public_oe property

Validation rules
public $rules

$table protected_oe property

The database table used by the model.
protected $table