Documentation

User extends User
in package
Uses SoftDelete

RainLab\User\Models\User

Tags
mixin

\Eloquent

Table of Contents

CREATED_AT  = 'created_at'
The name of the "created at" column.
UPDATED_AT  = 'updated_at'
The name of the "updated at" column.
$activated_at  : Carbon|null
$activation_code  : string|null
$attachMany  : mixed
protected $attachMany = [ 'pictures' => ['October\Rain\Database\Attach\File', 'name'=> 'imageable'] ];
$attachOne  : mixed
$attributeNames  : array<string|int, mixed>
$belongsTo  : mixed
protected $belongsTo = [ 'parent' => ['Category', 'key' => 'parent_id'] ];
$belongsToMany  : array<string|int, mixed>
$city  : string|null
$company  : string|null
$country_id  : int|null
$created_at  : Carbon|null
$created_ip_address  : string|null
$customMessages  : array<string|int, mixed>
$deleted_at  : Carbon|null
$duplicateCache  : bool
$email  : string
$exists  : bool
Indicates if the model exists.
$hasMany  : array<string|int, mixed>
Cleaner declaration of relationships.
$hasManyThrough  : mixed
protected $attachMany = [ 'pictures' => ['Picture', 'name'=> 'imageable'] ];
$hasOne  : mixed
protected $hasOne = [ 'owner' => ['User', 'key' => 'user_id'] ];
$id  : int
$implement  : array<string|int, mixed>
$incrementing  : bool
Indicates if the IDs are auto-incrementing.
$is_activated  : bool
$is_guest  : int
$is_superuser  : int
$iu_about  : string|null
$iu_blog  : string|null
$iu_comment  : string|null
$iu_company  : string|null
$iu_facebook  : string|null
$iu_gender  : string|null
$iu_icq  : string|null
$iu_job  : string|null
$iu_skype  : string|null
$iu_telephone  : string|null
$iu_twitter  : string|null
$iu_webpage  : string|null
$last_ip_address  : string|null
$last_login  : Carbon|null
$last_seen  : Carbon|null
$loginAttribute  : string
$manyMethods  : array<string|int, mixed>
The many to many relationship methods.
$mobile  : string|null
$morphedByMany  : mixed
$morphMany  : mixed
protected $morphMany = [ 'log' => ['History', 'name' => 'user'] ];
$morphOne  : mixed
protected $morphOne = [ 'log' => ['History', 'name' => 'user'] ];
$morphTo  : mixed
protected $morphTo = [ 'pictures' => [] ];
$morphToMany  : mixed
protected $morphToMany = [ 'tag' => ['Tag', 'table' => 'tagables', 'name' => 'tagable'] ];
$name  : string|null
$password  : string
$permissions  : string|null
$persist_code  : string|null
$phone  : string|null
$reset_password_code  : string|null
$rules  : array<string|int, mixed>
Validation rules
$sessionKey  : string
$settings  : string|null
$snakeAttributes  : bool
Indicates whether attributes are snake cased on arrays.
$state_id  : int|null
$street_addr  : string|null
$surname  : string|null
$timestamps  : bool
Indicates if the model should be timestamped.
$timezone_id  : int
$updated_at  : Carbon|null
$username  : string|null
$wasRecentlyCreated  : bool
Indicates if the model was inserted during the current request lifecycle.
$zip  : string|null
$allowedPermissionsValues  : array<string|int, mixed>
Allowed permissions values.
$appends  : array<string|int, mixed>
The accessors to append to the model's array form.
$attributes  : array<string|int, mixed>
The model's attributes.
$booted  : array<string|int, mixed>
The array of booted models.
$casts  : array<string|int, mixed>
The attributes that should be cast to native types.
$changes  : array<string|int, mixed>
The changed model attributes.
$connection  : string
The connection name for the model.
$dateFormat  : string
The storage format of the model's date columns.
$dates  : array<string|int, mixed>
The attributes that should be mutated to dates.
$dispatcher  : Dispatcher
The event dispatcher instance.
$dispatchesEvents  : array<string|int, mixed>
The event map for the model.
$emitterEventCollection  : array<string|int, mixed>
$emitterEventSorted  : array<string|int, mixed>
$emitterSingleEventCollection  : array<string|int, mixed>
$eventsBooted  : array<string|int, mixed>
$extendableCallbacks  : array<string|int, mixed>
$extendableGuardProperties  : bool
$extendableStaticMethods  : array<string|int, mixed>
$extensionData  : array<string|int, mixed>
$fillable  : array<string|int, mixed>
$forceDeleting  : bool
Indicates if the model is currently force deleting.
$globalScopes  : array<string|int, mixed>
The array of global scopes on the model.
$guardableColumns  : array<string|int, mixed>
The actual columns that exist on the database and can be guarded.
$guarded  : array<string|int, mixed>
Reset guarded fields, because we use $fillable instead.
$hashable  : array<string|int, mixed>
$hidden  : array<string|int, mixed>
The attributes that should be hidden for serialization.
$jsonable  : array<string|int, mixed>
$keyType  : string
The "type" of the auto-incrementing ID.
$mergedPermissions  : array<string|int, mixed>
$mutatorCache  : array<string|int, mixed>
The cache of the mutated attributes for each class.
$observables  : array<string|int, mixed>
User exposed observable events.
$original  : array<string|int, mixed>
The model attribute's original state.
$originalHashableValues  : array<string|int, mixed>
$originalPurgeableValues  : array<string|int, mixed>
$perPage  : int
The number of models to return for pagination.
$primaryKey  : string
The primary key for the model.
$purgeable  : array<string|int, mixed>
Purge attributes from data set.
$relations  : array<string|int, mixed>
The loaded relationships for the model.
$relationTypes  : array<string|int, mixed>
$rememberTokenName  : string
$resolver  : ConnectionResolverInterface
The connection resolver instance.
$table  : string
$touches  : array<string|int, mixed>
The relationships that should be touched on save.
$unguarded  : bool
Indicates if all mass assignment is enabled.
$validationDefaultAttrNames  : array<string|int, mixed>
$validationErrors  : MessageBag
$visible  : array<string|int, mixed>
The attributes that should be visible in serialization.
$with  : array<string|int, mixed>
The relations to eager load on every query.
$withCount  : array<string|int, mixed>
The relationship counts that should be eager loaded on every query.
__call()  : mixed
Handle dynamic method calls into the model.
__callStatic()  : mixed
Handle dynamic static method calls into the method.
__construct()  : void
Create a new Eloquent model instance.
__get()  : mixed
Dynamically retrieve attributes on the model.
__isset()  : bool
Determine if an attribute or relation exists on the model.
__set()  : void
Dynamically set attributes on the model.
__toString()  : string
Convert the model to its string representation.
__unset()  : void
Unset an attribute on the model.
__wakeup()  : void
When a model is being unserialized, check if it needs to be booted.
addCasts()  : void
Add attribute casts for the model.
addDateAttribute()  : void
Adds a datetime attribute to convert to an instance of Carbon/DateTime object.
addDynamicMethod()  : mixed
Programmatically adds a method to the extendable class
addDynamicProperty()  : mixed
Programmatically adds a property to the extendable class
addFillable()  : void
Add fillable attributes for the model.
addGlobalScope()  : mixed
Register a new global scope on the model.
addGroup()  : bool
Adds the user to the given group.
addHashable()  : $this
Adds an attribute to the hashable attributes list
addHashableAttribute()  : mixed
addHidden()  : void
Add hidden attributes for the model.
addJsonable()  : void
Add jsonable attributes for the model.
addObservableEvents()  : void
Add an observable event name.
addPurgeable()  : $this
Adds an attribute to the purgeable attributes list
addVisible()  : void
Add visible attributes for the model.
afterCreate()  : void
After create event
afterDelete()  : void
After delete event
afterLogin()  : void
After login event
all()  :
all()  : Collection|array<string|int, static>
Get all of the models from the database.
alwaysPush()  : bool
Pushes the first level of relations even if the parent model has no changes.
append()  : $this
Append attributes to query when building a query.
asExtension()  : mixed
Short hand for `getClassExtension()` method, except takes the short extension name, example:
attachMany()  : MorphMany
Define an attachment one-to-many relationship.
attachOne()  : MorphOne
Define an attachment one-to-one relationship.
attemptActivation()  : bool
Sends the confirmation email to a user, after activating.
attemptResetPassword()  : bool
Attempts to reset a user's password by matching the reset code generated with the user's.
attributesToArray()  : array<string|int, mixed>
Convert the model's attributes to an array.
ban()  : void
Ban this user, preventing them from signing in.
beforeLogin()  : void
Before login event
beforeValidate()  : void
Before validation event
belongsTo()  : BelongsTo
Define an inverse one-to-one or many relationship.
belongsToMany()  : BelongsToMany
Define a many-to-many relationship.
bindDeferred()  : mixed
Bind a deferred relationship to the supplied record.
bindEvent()  : self
Create a new event binding.
bindEventOnce()  : self
Create a new event binding that fires once only
bootHashable()  : void
Boot the hashable trait for a model.
bootPurgeable()  : void
Boot the purgeable trait for a model.
bootSoftDelete()  : void
Boot the soft deleting trait for a model.
bootValidation()  : void
Boot the validation trait for this model.
cacheMutatedAttributes()  : void
Extract and cache all the mutated attributes of a class.
cancelDeferred()  : mixed
Cancel all deferred bindings to this model.
checkHashValue()  : bool
Checks if the supplied plain value matches the stored hash value.
checkPassword()  : bool
Checks the password passed matches the user's password.
checkPersistCode()  : bool
Checks the given persist code.
checkResetPasswordCode()  : bool
Checks if the provided user reset password code is valid without actually resetting the password.
clearBootedModels()  : void
Clear the list of booted models so they will be re-booted.
clearExtendedClasses()  : void
Clear the list of extended classes so they will be re-extended.
clearResetPassword()  : void
Wipes out the data associated with resetting a password.
commitDeferred()  : mixed
Commit all deferred bindings to this model.
convertToRegistered()  : void
Converts a guest user to a registered one and sends an invitation notification.
create()  : Model|static
Save a new model and return the instance.
created()  : void
Register a created model event with the dispatcher.
creating()  : void
Register a creating model event with the dispatcher.
delete()  : bool|null
Delete the model from the database.
deleted()  : void
Register a deleted model event with the dispatcher.
deleting()  : void
Register a deleting model event with the dispatcher.
destroy()  : int
Destroy the models for the given IDs.
errors()  : MessageBag
Get validation error message collection for the Model
extend()  : mixed
Extend this object properties upon construction.
extendableCall()  : mixed
Magic method for `__call()`
extendableCallStatic()  : mixed
Magic method for `__callStatic()`
extendableConstruct()  : mixed
This method should be called as part of the constructor.
extendableExtendCallback()  : void
Helper method for `::extend()` static method
extendableGet()  : string
Magic method for `__get()`
extendableSet()  : string
Magic method for `__set()`
extendClassWith()  : void
Dynamically extend a class with a specified behavior
fetched()  : void
Create a new native event for handling afterFetch().
fetching()  : void
Create a new native event for handling beforeFetch().
fill()  : $this
Fill the model with an array of attributes.
fillable()  : $this
Set the fillable attributes for the model.
fillJsonAttribute()  : $this
Set a given JSON attribute on the model.
filterByGroup()  :
findByEmail()  : self
Looks up a user by their email address.
fireEvent()  : array<string|int, mixed>
Fire an event and call the listeners.
flushDuplicateCache()  : void
Flush the memory cache.
flushEventListeners()  : void
Remove all of the event listeners for the model.
forceDelete()  : bool|null
Force a hard delete on a soft deleted model.
forceFill()  : $this
Fill the model with an array of attributes. Force mass assignment.
forceSave()  : bool
Force save the model even if validation fails.
fresh()  : static|null
Reload a fresh model instance from the database.
freshTimestamp()  : Carbon
Get a fresh timestamp for the model.
freshTimestampString()  : string
Get a fresh timestamp for the model.
fromDateTime()  : string
Convert a DateTime to a storable string.
fromJson()  : mixed
Decode the given JSON back into an array or object.
get()  :
getActivationCode()  : string
Get an activation code for the given user.
getActualClassNameForMorph()  : string
Retrieve the actual class name for a given morph class.
getAttribute()  : mixed
Get an attribute from the model.
getAttributes()  : array<string|int, mixed>
Get all of the current attributes on the model.
getAttributeValue()  : mixed
Get a plain attribute (not a relationship).
getAuthIdentifier()  : mixed
Get the unique identifier for the user.
getAuthIdentifierName()  : string
Get the name of the unique identifier for the user.
getAuthPassword()  : string
Get the password for the user.
getAvatarThumb()  : mixed
Returns the public image file path to this user's avatar.
getCasts()  : array<string|int, mixed>
Get the casts array.
getChanges()  : array<string|int, mixed>
Get the attributes that were changed.
getClassExtension()  : mixed
Returns a behavior object from an extendable class, example:
getClassMethods()  : array<string|int, mixed>
Get a list of class methods, extension equivalent of get_class_methods()
getConnection()  : Connection
Get the database connection for the model.
getConnectionName()  : string
Get the current connection name for the model.
getConnectionResolver()  : ConnectionResolverInterface
Get the connection resolver instance.
getCreatedAtColumn()  : string
Get the name of the "created at" column.
getDates()  : array<string|int, mixed>
Get the attributes that should be converted to dates.
getDeletedAtColumn()  : string
Get the name of the "deleted at" column.
getDirty()  : array<string|int, mixed>
Get the attributes that have been changed since last sync.
getDynamicProperties()  : array<string|int, mixed>
Returns all dynamic properties and their values
getEventDispatcher()  : Dispatcher
Get the event dispatcher instance.
getFillable()  : array<string|int, mixed>
Get the fillable attributes for the model.
getForeignKey()  : string
Get the default foreign key name for the model.
getGlobalScope()  : Scope|Closure|null
Get a global scope registered with the model.
getGlobalScopes()  : array<string|int, mixed>
Get the global scopes for this class instance.
getGroups()  : array<string|int, mixed>
Returns an array of groups which the given user belongs to.
getGuarded()  : array<string|int, mixed>
Get the guarded attributes for the model.
getHashableAttributes()  : array<string|int, mixed>
Returns a collection of fields that will be hashed.
getHidden()  : array<string|int, mixed>
Get the hidden attributes for the model.
getIncrementing()  : bool
Get the value indicating whether the IDs are incrementing.
getIsActivatedAttribute()  : bool
Get mutator for giving the activated property.
getJsonable()  : array<string|int, mixed>
Get the jsonable attributes name
getKey()  : mixed
Get the value of the model's primary key.
getKeyName()  : string
Get the primary key for the model.
getKeyType()  : string
Get the auto-incrementing key type.
getLastSeen()  : Carbon
Returns the date this user was last seen.
getLogin()  : mixed
getLoginName()  : string
Returns the name for the user's login.
getMergedPermissions()  : array<string|int, mixed>
Returns an array of merged permissions for each group the user is in.
getMinPasswordLength()  : int
Returns the minimum length for a new password from settings.
getMorphClass()  : string
Get the class name for polymorphic relations.
getMutatedAttributes()  : array<string|int, mixed>
Get the mutated attributes for a given instance.
getNotificationVars()  : array<string|int, mixed>
Returns the variables available when sending a user notification.
getObservableEvents()  : array<string|int, mixed>
Get the observable event names.
getOriginal()  : mixed|array<string|int, mixed>
Get the model's original attribute values.
getOriginalHashValue()  : mixed
Returns the original values of any hashed attributes.
getOriginalHashValues()  : array<string|int, mixed>
Returns the original values of any hashed attributes.
getOriginalPurgeValue()  : mixed
Returns the original values of any purged attributes.
getOriginalPurgeValues()  : mixed
Returns the original values of any purged attributes.
getPerPage()  : int
Get the number of models to return per page.
getPersistCode()  : string
Gets a code for when the user is persisted to a cookie or session which identifies the user.
getPurgeableAttributes()  : mixed
Returns a collection of fields that will be hashed.
getQualifiedDeletedAtColumn()  : string
Get the fully qualified "deleted at" column.
getQualifiedKeyName()  : string
Get the table qualified key name.
getQueueableConnection()  : mixed
Get the queueable connection for the entity.
getQueueableId()  : mixed
Get the queueable identity for the entity.
getRandomString()  : string
Generate a random string
getRelation()  : mixed
Get a specified relationship.
getRelationDefinition()  : array<string|int, mixed>
Returns relationship details from a supplied name.
getRelationDefinitions()  : array<string|int, mixed>
Returns relationship details for all relations defined on this model.
getRelations()  : array<string|int, mixed>
Get all the loaded relations for the instance.
getRelationType()  : string
Returns a relationship type based on a supplied name.
getRelationValue()  : mixed
Get a relationship.
getRememberToken()  : string
Get the token value for the "remember me" session.
getRememberTokenName()  : string
Get the column name for the "remember me" token.
getReminderEmail()  : string
Get the e-mail address where password reminders are sent.
getResetPasswordCode()  : string
Get a reset password code for the given user.
getRole()  : Role
Returns the role assigned to this user.
getRouteKey()  : mixed
Get the value of the model's route key.
getRouteKeyName()  : string
Get the route key for the model.
getTable()  : string
Get the table associated with the model.
getTouchedRelations()  : array<string|int, mixed>
Get the relationships that are touched on save.
getUpdatedAtColumn()  : string
Get the name of the "updated at" column.
getVisible()  : array<string|int, mixed>
Get the visible attributes for the model.
guard()  : $this
Set the guarded attributes for the model.
hasAccess()  : bool
See if a user has access to the passed permission(s).
hasAnyAccess()  : bool
Returns if the user has access to any of the given permissions.
hasCast()  : bool
Determine whether an attribute should be cast to a native type.
hasGetMutator()  : bool
Determine if a get mutator exists for an attribute.
hasGlobalScope()  : bool
Determine if a model has a global scope.
hasMany()  : HasMany
Define a one-to-many relationship.
hasManyThrough()  : HasManyThrough
Define a has-many-through relationship.
hasOne()  : HasOne
Define a one-to-one relationship.
hasPermission()  : bool
See if a user has access to the passed permission(s).
hasRelation()  : bool
Checks if model has a relationship by supplied name.
hasSetMutator()  : bool
Determine if a set mutator exists for an attribute.
inGroup()  : bool
See if the user is in the given group.
is()  : bool
Determine if two models have the same ID and belong to the same table.
isActivated()  :
isAttributeRequired()  : bool
Determines if an attribute is required based on the validation rules.
isBanned()  : bool
Check if the user is banned.
isClassExtendedWith()  : bool
Check if extendable class is extended with a behavior object
isClean()  : bool
Determine if the model or given attribute(s) have remained the same.
isDeferrable()  : mixed
Returns true if a relation exists and can be deferred.
isDirty()  : bool
Determine if the model or given attribute(s) have been modified.
isFillable()  : bool
Determine if the given attribute may be mass assigned.
isGuarded()  : bool
Determine if the given key is guarded.
isJsonable()  : array<string|int, mixed>
Checks if an attribute is jsonable or not.
isNot()  : bool
Determine if two models are not the same.
isOnline()  : bool
Returns true if the user has been active within the last 5 minutes.
isRegisterThrottled()  : bool
Returns true if IP address is throttled and cannot register again. Maximum 3 registrations every 60 minutes.
isRelationPushable()  : bool
Determines whether the specified relation should be saved when push() is called instead of save() on the model. Default: true.
isSoftDelete()  : bool
Helper method to check if the model is currently being hard or soft deleted, useful in events.
isSuperUser()  : bool
Checks if the user is a super user - has access to everything regardless of permissions.
isSuspended()  : bool
Check if the user is suspended.
isUnguarded()  : bool
Determine if current state is "unguarded".
joiningTable()  : string
Get the joining table name for a many-to-many relation.
jsonable()  : $this
Set the jsonable attributes for the model.
jsonSerialize()  : array<string|int, mixed>
Convert the object into something JSON serializable.
load()  : $this
Eager load relations on the model.
loadMissing()  : $this
Eager load relations on the model if they are not already eager loaded.
make()  : Model|static
Create a new model and return the instance.
makeHashValue()  : string
Hashes an attribute value and saves it in the original locker.
makeHidden()  : $this
Make the given, typically visible, attributes hidden.
makeRelation()  : string
Returns a relation class object
makeVisible()  : $this
Make the given, typically hidden, attributes visible.
methodExists()  : bool
Checks if a method exists, extension equivalent of method_exists()
morphedByMany()  : MorphToMany
Define a polymorphic, inverse many-to-many relationship.
morphMany()  : MorphMany
Define a polymorphic one-to-many relationship.
morphOne()  : MorphOne
Define a polymorphic one-to-one relationship.
morphTo()  : MorphTo
Define a polymorphic, inverse one-to-one or many relationship.
morphToMany()  : MorphToMany
Define a polymorphic many-to-many relationship.
newCollection()  : Collection
Create a new Eloquent Collection instance.
newEloquentBuilder()  : Builder|static
Create a new Eloquent query builder for the model.
newFromBuilder()  : static
Create a new model instance that is existing.
newInstance()  : static
Create a new instance of the given model.
newModelQuery()  : Builder|static
Get a new query builder that doesn't have any global scopes or eager loading.
newModelQuery()  :
newPivot()  : Pivot
Create a new pivot model instance.
newQuery()  :
newQuery()  : Builder
Get a new query builder for the model's table.
newQueryForRestoration()  : Builder
Get a new query to restore one or more models by their queueable IDs.
newQueryWithoutRelationships()  : Builder
Get a new query builder with no relationships loaded.
newQueryWithoutScope()  : Builder
Get a new query instance without a given scope.
newQueryWithoutScopes()  : Builder|static
Get a new query builder that doesn't have any global scopes.
newRelationPivot()  : Pivot
Create a pivot model instance specific to a relation.
observe()  : void
Register an observer with the Model.
offsetExists()  : bool
Determine if the given attribute exists.
offsetGet()  : mixed
Get the value for a given offset.
offsetSet()  : void
Set the value for a given offset.
offsetUnset()  : void
Unset the value for a given offset.
on()  : Builder
Begin querying the model on a given connection.
only()  : array<string|int, mixed>
Get a subset of the model's attributes.
onlyTrashed()  : Builder|static
Get a new query builder that only includes soft deletes.
onWriteConnection()  : Builder
Begin querying the model on the write connection.
propertyExists()  : bool
Checks if a property exists, extension equivalent of `property_exists()`
purgeAttributes()  : array<string|int, mixed>
Removes purged attributes from the dataset, used before saving.
push()  : bool
Save the model and all of its relationships.
qualifyColumn()  : string
Qualify the given column name by the model's table.
query()  : Builder
Begin querying the model.
query()  :
refresh()  : $this
Reload the current model instance with fresh attributes from the database.
registerGlobalScopes()  : Builder
Register the global scopes for this builder instance.
reguard()  : void
Enable the mass assignment restrictions.
relationLoaded()  : bool
Determine if the given relation is loaded.
relationsToArray()  : array<string|int, mixed>
Get the model's relationships in array form.
reload()  : Model|static
Reloads the model attributes from the database.
reloadRelations()  : void
Reloads the model relationship cache.
removeGroup()  : bool
Removes the user from the given group.
removeObservableEvents()  : void
Remove an observable event name.
replicate()  : Model
Clone the model into a new, non-existing instance.
resolveConnection()  : Connection
Resolve a connection instance.
resolveRouteBinding()  : Model|null
Retrieve the model for a bound value.
restore()  : bool|null
Restore a soft-deleted model instance.
restored()  : void
Register a restored model event with the dispatcher.
restorePurgedValues()  : mixed
Restores the original values of any purged attributes.
restoring()  : void
Register a restoring model event with the dispatcher.
retrieved()  : void
Register a retrieved model event with the dispatcher.
save()  : bool
Save the model to the database.
saved()  : void
Register a saved model event with the dispatcher.
saveOrFail()  : bool
Save the model to the database using transaction.
saving()  : void
Register a saving model event with the dispatcher.
scopeFilterByGroup()  : mixed
scopeIsActivated()  : mixed
setAppends()  : $this
Set the accessors to append to model arrays.
setAttribute()  : $this
Set a given attribute on the model.
setConnection()  : $this
Set the connection associated with the model.
setConnectionResolver()  : void
Set the connection resolver instance.
setCreatedAt()  : $this
Set the value of the "created at" attribute.
setDateFormat()  : $this
Set the date format used by the model.
setEventDispatcher()  : void
Set the event dispatcher instance.
setHidden()  : $this
Set the hidden attributes for the model.
setIncrementing()  : $this
Set whether IDs are incrementing.
setKeyName()  : $this
Set the primary key for the model.
setKeyType()  : $this
Set the data type for the primary key.
setObservableEvents()  : $this
Set the observable event names.
setPasswordAttribute()  : mixed
Protects the password from being reset to null.
setPermissionsAttribute()  : void
Validate any set permissions.
setPerPage()  : $this
Set the number of models to return per page.
setRawAttributes()  : $this
Set the array of model attributes. No checking is done.
setRelation()  : $this
Set the specific relationship in the model.
setRelations()  : $this
Set the entire relations array on the model.
setRememberToken()  : void
Set the token value for the "remember me" session.
setTable()  : $this
Set the table associated with the model.
setTouchedRelations()  : $this
Set the relationships that are touched on save.
setUpdatedAt()  : $this
Set the value of the "updated at" attribute.
setValidationAttributeName()  : void
Programatically sets the validation attribute names, will take lower priority to model defined attribute names found in `$attributeNames`.
setValidationAttributeNames()  : void
Programatically sets multiple validation attribute names.
setVisible()  : $this
Set the visible attributes for the model.
syncChanges()  : $this
Sync the changed attributes.
syncOriginal()  : $this
Sync the original attributes with the current.
syncOriginalAttribute()  : $this
Sync a single original attribute with its current value.
toArray()  : array<string|int, mixed>
Convert the model instance to an array.
toJson()  : string
Convert the model instance to JSON.
totallyGuarded()  : bool
Determine if the model is totally guarded.
touch()  : bool
Update the model's update timestamp.
touches()  : bool
Determine if the model touches a given relation.
touchIpAddress()  : void
Records the last_ip_address to reflect the last known IP for this user.
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.
touchOwners()  : void
Touch the owning relations of the model.
trashed()  : bool
Determine if the model instance has been soft-deleted.
unban()  : void
Remove the ban on this user.
unbindDeferred()  : mixed
Unbind a deferred relationship to the supplied record.
unbindEvent()  : self
Destroys an event binding.
unguard()  : void
Disable all mass assignable restrictions.
unguarded()  : mixed
Run the given callable while being unguarded.
unsetConnectionResolver()  : void
Unset the connection resolver for models.
unsetEventDispatcher()  : void
Unset the event dispatcher for models.
unsuspend()  : void
Remove the suspension on this user.
update()  : bool
Update the model in the database.
updated()  : void
Register an updated model event with the dispatcher.
updating()  : void
Register an updating model event with the dispatcher.
usesTimestamps()  : bool
Determine if the model uses timestamps.
validate()  : bool
Validate the model instance
validated()  : void
Create a new native event for handling afterValidate().
validating()  : void
Create a new native event for handling beforeValidate().
wasChanged()  : bool
Determine if the model or given attribute(s) have been modified.
whereActivatedAt()  :
whereActivationCode()  :
whereCity()  :
whereCompany()  :
whereCountryId()  :
whereCreatedAt()  :
whereCreatedIpAddress()  :
whereDeletedAt()  :
whereEmail()  :
whereId()  :
whereIsActivated()  :
whereIsGuest()  :
whereIsSuperuser()  :
whereIuAbout()  :
whereIuBlog()  :
whereIuComment()  :
whereIuCompany()  :
whereIuFacebook()  :
whereIuGender()  :
whereIuIcq()  :
whereIuJob()  :
whereIuSkype()  :
whereIuTelephone()  :
whereIuTwitter()  :
whereIuWebpage()  :
whereLastIpAddress()  :
whereLastLogin()  :
whereLastSeen()  :
whereMobile()  :
whereName()  :
wherePassword()  :
wherePermissions()  :
wherePersistCode()  :
wherePhone()  :
whereResetPasswordCode()  :
whereSettings()  :
whereStateId()  :
whereStreetAddr()  :
whereSurname()  :
whereTimezoneId()  :
whereUpdatedAt()  :
whereUsername()  :
whereZip()  :
with()  : Builder|static
Begin querying a model with eager loading.
withTrashed()  : Builder|static
Get a new query builder that includes soft deletes.
addCastAttributesToArray()  : array<string|int, mixed>
Add the casted attributes to the attributes array.
addDateAttributesToArray()  : array<string|int, mixed>
Add the date attributes to the attributes array.
addMutatedAttributesToArray()  : array<string|int, mixed>
Add the mutated attributes to the attributes array.
afterFetch()  : mixed
Handle the "fetched" model event
afterSave()  : mixed
Handle the "saved" model event
afterUpdate()  : mixed
Handle the "updated" model event
asDate()  : Carbon
Return a timestamp as DateTime object with time set to 00:00:00.
asDateTime()  : Carbon
Return a timestamp as DateTime object.
asJson()  : string
Encode the given value as JSON.
asTimestamp()  : int
Return a timestamp as unix timestamp.
beforeCreate()  : mixed
Handle the "creating" model event
beforeDelete()  : mixed
Handle the "deleting" model event
beforeFetch()  : mixed
Handle the "fetching" model event
beforeSave()  : mixed
Handle the "saving" model event
beforeUpdate()  : mixed
Handle the "updating" model event
boot()  : void
The "booting" method of the model.
bootIfNotBooted()  : void
Check if the model needs to be booted and if so, do it.
bootNicerEvents()  : mixed
Bind some nicer events to this model, in the format of method overrides.
bootTraits()  : void
Boot all of the bootable traits on the model.
castAttribute()  : mixed
Cast an attribute to a native PHP type.
castAttributeAsJson()  : string
Cast the given attribute to JSON.
commitDeferredAfter()  : mixed
Internally used method to commit all deferred bindings after saving.
commitDeferredBefore()  : mixed
Internally used method to commit all deferred bindings before saving.
commitDeferredOfType()  : mixed
Internal method for committing deferred relations.
decrement()  : int
Decrement a column's value by a given amount.
emitterEventSortEvents()  : array<string|int, mixed>
Sort the listeners for a given event by priority.
extendableIsAccessible()  : bool
Checks if a property is accessible, property equivalent of `is_callable()`
extensionExtractMethods()  : void
Extracts the available methods from a behavior and adds it to the list of callable methods.
fillableFromArray()  : array<string|int, mixed>
Get the fillable attributes of a given array.
filterModelEventResults()  : mixed
Filter the model event results.
finishSave()  : void
Perform any actions that are necessary after the model is saved.
fireCustomModelEvent()  : mixed|null
Fire a custom model event for the given event.
fireModelEvent()  : mixed
Fire the given event for the model.
generatePassword()  : void
Assigns this user with a random password.
getArrayableAppends()  : array<string|int, mixed>
Get all of the appendable values that are arrayable.
getArrayableAttributes()  : array<string|int, mixed>
Get an attribute array of all arrayable attributes.
getArrayableItems()  : array<string|int, mixed>
Get an attribute array of all arrayable values.
getArrayableRelations()  : array<string|int, mixed>
Get an attribute array of all arrayable relations.
getArrayAttributeByKey()  : array<string|int, mixed>
Get an array attribute or return an empty array if it is not set.
getArrayAttributeWithValue()  : $this
Get an array attribute with the given key and value set.
getAttributeFromArray()  : mixed
Get an attribute from the $attributes array.
getCastType()  : string
Get the type of cast for a model attribute.
getDateFormat()  : string
Get the format for database stored dates.
getDeferrableRelationTypes()  : array<string|int, mixed>
Returns all possible relation types that can be deferred.
getDeferredBindingRecords()  : Collection
Returns any outstanding binding records for this model.
getKeyForSaveQuery()  : mixed
Get the primary key value for a save query.
getMorphs()  : array<string|int, mixed>
Get the polymorphic relationship columns.
getMutatorMethods()  : array<string|int, mixed>
Get all of the attribute mutator methods.
getRelationCaller()  : mixed
Finds the calling function name from the stack trace.
getRelationDefaults()  : array<string|int, mixed>
Returns default relation arguments for a given type.
getRelationshipFromMethod()  : mixed
Get a relationship value from a method.
getRelationValidationValue()  : mixed
Attachments validate differently to their simple values.
getValidationAttributes()  : array<string|int, mixed>
Returns the model data used for validation.
guessBelongsToManyRelation()  : string
Get the relationship name of the belongs to many.
guessBelongsToRelation()  : string
Guess the "belongs to" relationship name.
handleRelation()  : Relation
Looks for the relation and does the correct magic as Eloquent would require inside relation methods. For more information, read the documentation of the mentioned property.
hasChanges()  : bool
Determine if the given attributes were changed.
increment()  : int
Increment a column's value by a given amount.
incrementOrDecrement()  : int
Run the increment or decrement method on the model.
incrementOrDecrementAttributeValue()  : void
Increment the underlying attribute value and sync with original.
insertAndSetId()  : void
Insert the given attributes and set the ID on the model.
isDateAttribute()  : bool
Determine if the given attribute is a date or date castable.
isDateCastable()  : bool
Determine whether a value is Date / DateTime castable for inbound manipulation.
isGuardableColumn()  : bool
Determine if the given column is a valid, guardable column.
isJsonCastable()  : bool
Determine whether a value is JSON castable for inbound manipulation.
isStandardDateFormat()  : bool
Determine if the given value is a standard date format.
makeValidator()  : Validator
Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel. Optional connection string to make the validator use a different database connection than the default connection.
morphEagerTo()  : MorphTo
Define a polymorphic, inverse one-to-one or many relationship.
morphInstanceTo()  : MorphTo
Define a polymorphic, inverse one-to-one or many relationship.
mutateAttribute()  : mixed
Get the value of an attribute using its mutator.
mutateAttributeForArray()  : mixed
Get the value of an attribute using its mutator for array conversion.
newBaseQueryBuilder()  : Builder
Get a new query builder instance for the connection.
newBelongsTo()  : BelongsTo
Instantiate a new BelongsTo relationship.
newBelongsToMany()  : BelongsToMany
Instantiate a new BelongsToMany relationship.
newHasMany()  : HasMany
Instantiate a new HasMany relationship.
newHasManyThrough()  : HasManyThrough
Instantiate a new HasManyThrough relationship.
newHasOne()  : HasOne
Instantiate a new HasOne relationship.
newMorphMany()  : MorphMany
Instantiate a new MorphMany relationship.
newMorphOne()  : MorphOne
Instantiate a new MorphOne relationship.
newMorphTo()  : MorphTo
Instantiate a new MorphTo relationship.
newMorphToMany()  : MorphToMany
Instantiate a new HasManyThrough relationship.
newRelatedInstance()  : mixed
Create a new model instance for a related model.
originalIsEquivalent()  : bool
Determine if the new and old values for a given key are equivalent.
performDeleteOnModel()  : void
Perform the actual delete query on this model instance.
performDeleteOnRelations()  : void
Locates relations with delete flag and cascades the delete event.
performInsert()  : bool
Perform a model insert operation.
performRestoreOnRelations()  : void
Locates relations with softDelete flag and cascades the restore event.
performSoftDeleteOnRelations()  : void
Locates relations with softDelete flag and cascades the delete event.
performUpdate()  : bool
Perform a model update operation.
processRuleFieldNames()  : array<string|int, mixed>
Processes field names in a rule array.
processValidationRules()  : mixed
Process rules
processValidationUniqueRule()  : string
Rebuilds the unique validation rule to force for the existing ID
registerModelEvent()  : void
Register a model event with the dispatcher.
removeTableFromKey()  : string
Remove the table name from a given key.
runSoftDelete()  : void
Perform the actual delete query on this model instance.
saveInternal()  : bool
Save the model to the database. Is used by {@link save()} and {@link forceSave()}.
sendInvitation()  : void
Sends an invitation to the user using template "rainlab.user::mail.invite".
serializeDate()  : string
Prepare a date for array / JSON serialization.
setKeysForSaveQuery()  : Builder
Set the keys for a save update query.
setRelationValue()  : mixed
Sets a relation value directly from its attribute.
updateTimestamps()  : void
Update the creation and update timestamps.
validateRelationArgs()  : mixed
Validate relation supplied arguments.

Constants

CREATED_AT

The name of the "created at" column.

public string CREATED_AT = 'created_at'

UPDATED_AT

The name of the "updated at" column.

public string UPDATED_AT = 'updated_at'

Properties

$activation_code

public string|null $activation_code

$attachMany

protected $attachMany = [ 'pictures' => ['October\Rain\Database\Attach\File', 'name'=> 'imageable'] ];

public mixed $attachMany = []

$attachOne

public mixed $attachOne = ['avatar' => SystemModelsFile::class]

$attributeNames

public array<string|int, mixed> $attributeNames = []

The array of custom attribute names.

$belongsTo

protected $belongsTo = [ 'parent' => ['Category', 'key' => 'parent_id'] ];

public mixed $belongsTo = []

$belongsToMany

public array<string|int, mixed> $belongsToMany = ['groups' => [RainLabUserModelsUserGroup::class, 'table' => 'users_groups']]

Relations

$city

public string|null $city

$company

public string|null $company

$country_id

public int|null $country_id

$created_ip_address

public string|null $created_ip_address

$customMessages

public array<string|int, mixed> $customMessages = []

The array of custom error messages.

$duplicateCache

public bool $duplicateCache = true

Indicates if duplicate queries from this model should be cached in memory.

$email

public string $email

$exists

Indicates if the model exists.

public bool $exists = false

$hasMany

Cleaner declaration of relationships.

public array<string|int, mixed> $hasMany = []

Uses a similar approach to the relation methods used by Eloquent, but as separate properties that make the class file less cluttered.

It should be declared with keys as the relation name, and value being a mixed array. The relation type $morphTo does not include a classname as the first value.

Example: class Order extends Model { protected $hasMany = [ 'items' => 'Item' ]; }

$hasManyThrough

protected $attachMany = [ 'pictures' => ['Picture', 'name'=> 'imageable'] ];

public mixed $hasManyThrough = []

$hasOne

protected $hasOne = [ 'owner' => ['User', 'key' => 'user_id'] ];

public mixed $hasOne = []

$implement

public array<string|int, mixed> $implement

Behaviors implemented by this model.

$incrementing

Indicates if the IDs are auto-incrementing.

public bool $incrementing = true

$is_activated

public bool $is_activated

$is_guest

public int $is_guest

$is_superuser

public int $is_superuser

$iu_about

public string|null $iu_about

$iu_blog

public string|null $iu_blog

$iu_comment

public string|null $iu_comment

$iu_company

public string|null $iu_company

$iu_facebook

public string|null $iu_facebook

$iu_gender

public string|null $iu_gender

$iu_icq

public string|null $iu_icq

$iu_job

public string|null $iu_job

$iu_skype

public string|null $iu_skype

$iu_telephone

public string|null $iu_telephone

$iu_twitter

public string|null $iu_twitter

$iu_webpage

public string|null $iu_webpage

$last_ip_address

public string|null $last_ip_address

$loginAttribute

public static string $loginAttribute = null

The login attribute.

$manyMethods

The many to many relationship methods.

public static array<string|int, mixed> $manyMethods = ['belongsToMany', 'morphToMany', 'morphedByMany', 'guessBelongsToManyRelation', 'findFirstMethodThatIsntRelation']

$mobile

public string|null $mobile

$morphMany

protected $morphMany = [ 'log' => ['History', 'name' => 'user'] ];

public mixed $morphMany = []

$morphOne

protected $morphOne = [ 'log' => ['History', 'name' => 'user'] ];

public mixed $morphOne = []

$morphTo

protected $morphTo = [ 'pictures' => [] ];

public mixed $morphTo = []

$morphToMany

protected $morphToMany = [ 'tag' => ['Tag', 'table' => 'tagables', 'name' => 'tagable'] ];

public mixed $morphToMany = []

$name

public string|null $name

$password

public string $password

$permissions

public string|null $permissions

$persist_code

public string|null $persist_code

$phone

public string|null $phone

$reset_password_code

public string|null $reset_password_code

$rules

Validation rules

public array<string|int, mixed> $rules = ['email' => 'required|between:6,255|email|unique:users', 'avatar' => 'nullable|image|max:4000', 'username' => 'required|between:2,255|unique:users', 'password' => 'required:create|between:8,255|confirmed', 'password_confirmation' => 'required_with:password|between:8,255']

Validation rules

$sessionKey

public string $sessionKey

A unique session key used for deferred binding.

$settings

public string|null $settings

$snakeAttributes

Indicates whether attributes are snake cased on arrays.

public static bool $snakeAttributes = true

$state_id

public int|null $state_id

$street_addr

public string|null $street_addr

$surname

public string|null $surname

$timestamps

Indicates if the model should be timestamped.

public bool $timestamps = true

$timezone_id

public int $timezone_id

$username

public string|null $username

$wasRecentlyCreated

Indicates if the model was inserted during the current request lifecycle.

public bool $wasRecentlyCreated = false

$zip

public string|null $zip

$allowedPermissionsValues

Allowed permissions values.

protected array<string|int, mixed> $allowedPermissionsValues = [-1, 0, 1]

Possible options: -1 => Deny (adds to array, but denies regardless of user's group). 0 => Remove. 1 => Add.

$appends

The accessors to append to the model's array form.

protected array<string|int, mixed> $appends = []

$attributes

The model's attributes.

protected array<string|int, mixed> $attributes = []

$booted

The array of booted models.

protected static array<string|int, mixed> $booted = []

$casts

The attributes that should be cast to native types.

protected array<string|int, mixed> $casts = []

$changes

The changed model attributes.

protected array<string|int, mixed> $changes = []

$connection

The connection name for the model.

protected string $connection

$dateFormat

The storage format of the model's date columns.

protected string $dateFormat

$dates

The attributes that should be mutated to dates.

protected array<string|int, mixed> $dates = ['last_seen', 'deleted_at', 'created_at', 'updated_at', 'activated_at', 'last_login']

$dispatcher

The event dispatcher instance.

protected static Dispatcher $dispatcher

$dispatchesEvents

The event map for the model.

protected array<string|int, mixed> $dispatchesEvents = []

Allows for object-based events for native Eloquent events.

$emitterEventCollection

protected array<string|int, mixed> $emitterEventCollection = []

Collection of registered events.

$emitterEventSorted

protected array<string|int, mixed> $emitterEventSorted = []

Sorted collection of events.

$emitterSingleEventCollection

protected array<string|int, mixed> $emitterSingleEventCollection = []

Collection of registered events to be fired once only.

$eventsBooted

protected static array<string|int, mixed> $eventsBooted = []

The array of models booted events.

$extendableCallbacks

protected static array<string|int, mixed> $extendableCallbacks = []

Used to extend the constructor of an extendable class. Eg:

Class::extend(function($obj) { })

$extendableGuardProperties

protected static bool $extendableGuardProperties = true

Indicates if dynamic properties can be created.

$extendableStaticMethods

protected static array<string|int, mixed> $extendableStaticMethods = []

Collection of static methods used by behaviors.

$extensionData

protected array<string|int, mixed> $extensionData = ['extensions' => [], 'methods' => [], 'dynamicMethods' => [], 'dynamicProperties' => []]

Class reflection information, including behaviors.

$fillable

protected array<string|int, mixed> $fillable = ['name', 'surname', 'login', 'username', 'email', 'password', 'password_confirmation', 'created_ip_address', 'last_ip_address']

The attributes that are mass assignable.

$forceDeleting

Indicates if the model is currently force deleting.

protected bool $forceDeleting = false

$globalScopes

The array of global scopes on the model.

protected static array<string|int, mixed> $globalScopes = []

$guardableColumns

The actual columns that exist on the database and can be guarded.

protected static array<string|int, mixed> $guardableColumns = []

$guarded

Reset guarded fields, because we use $fillable instead.

protected array<string|int, mixed> $guarded = ['*']

The attributes that aren't mass assignable.

$hashable

protected array<string|int, mixed> $hashable = ['password', 'persist_code']

List of attribute names which should be hashed using the Bcrypt hashing algorithm.

$hidden

The attributes that should be hidden for serialization.

protected array<string|int, mixed> $hidden = []

$jsonable

protected array<string|int, mixed> $jsonable = []

List of attribute names which are json encoded and decoded from the database.

$keyType

The "type" of the auto-incrementing ID.

protected string $keyType = 'int'

$mergedPermissions

protected array<string|int, mixed> $mergedPermissions

The user merged permissions.

$mutatorCache

The cache of the mutated attributes for each class.

protected static array<string|int, mixed> $mutatorCache = []

$observables

User exposed observable events.

protected array<string|int, mixed> $observables = []

These are extra user-defined events observers may subscribe to.

$original

The model attribute's original state.

protected array<string|int, mixed> $original = []

$originalHashableValues

protected array<string|int, mixed> $originalHashableValues = []

List of original attribute values before they were hashed.

$originalPurgeableValues

protected array<string|int, mixed> $originalPurgeableValues = []

List of original attribute values before they were purged.

$perPage

The number of models to return for pagination.

protected int $perPage = 15

$primaryKey

The primary key for the model.

protected string $primaryKey = 'id'

$purgeable

Purge attributes from data set.

protected array<string|int, mixed> $purgeable = ['password_confirmation', 'send_invite']

List of attribute names which should not be saved to the database.

$relations

The loaded relationships for the model.

protected array<string|int, mixed> $relations = []

$relationTypes

protected static array<string|int, mixed> $relationTypes = ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany', 'morphTo', 'morphOne', 'morphMany', 'morphToMany', 'morphedByMany', 'attachOne', 'attachMany', 'hasManyThrough']

Excepted relationship types, used to cycle and verify relationships.

$rememberTokenName

protected string $rememberTokenName = 'persist_code'

The column name of the "remember me" token.

$table

protected string $table = 'users'

The database table used by the model.

$touches

The relationships that should be touched on save.

protected array<string|int, mixed> $touches = []

$unguarded

Indicates if all mass assignment is enabled.

protected static bool $unguarded = false

$validationDefaultAttrNames

protected array<string|int, mixed> $validationDefaultAttrNames = []

Default custom attribute names.

$validationErrors

protected MessageBag $validationErrors

The message bag instance containing validation error messages

$visible

The attributes that should be visible in serialization.

protected array<string|int, mixed> $visible = []

$with

The relations to eager load on every query.

protected array<string|int, mixed> $with = []

$withCount

The relationship counts that should be eager loaded on every query.

protected array<string|int, mixed> $withCount = []

Methods

__call()

Handle dynamic method calls into the model.

public __call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string
$parameters : array<string|int, mixed>
Return values
mixed —

__callStatic()

Handle dynamic static method calls into the method.

public static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string
$parameters : array<string|int, mixed>
Return values
mixed —

__construct()

Create a new Eloquent model instance.

public __construct([array<string|int, mixed> $attributes = [] ]) : void
Parameters
$attributes : array<string|int, mixed> = []
Return values
void —

__get()

Dynamically retrieve attributes on the model.

public __get(string $key) : mixed
Parameters
$key : string
Return values
mixed —

__isset()

Determine if an attribute or relation exists on the model.

public __isset(string $key) : bool
Parameters
$key : string
Return values
bool —

__set()

Dynamically set attributes on the model.

public __set(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed
Return values
void —

__toString()

Convert the model to its string representation.

public __toString() : string
Return values
string —

__unset()

Unset an attribute on the model.

public __unset(string $key) : void
Parameters
$key : string
Return values
void —

__wakeup()

When a model is being unserialized, check if it needs to be booted.

public __wakeup() : void
Return values
void —

addCasts()

Add attribute casts for the model.

public addCasts(array<string|int, mixed> $attributes) : void
Parameters
$attributes : array<string|int, mixed>
Return values
void —

addDateAttribute()

Adds a datetime attribute to convert to an instance of Carbon/DateTime object.

public addDateAttribute(string $attribute) : void
Parameters
$attribute : string
Return values
void —

addDynamicMethod()

Programmatically adds a method to the extendable class

public addDynamicMethod(string $dynamicName, callable $method[, string $extension = null ]) : mixed
Parameters
$dynamicName : string
$method : callable
$extension : string = null
Return values
mixed —

addDynamicProperty()

Programmatically adds a property to the extendable class

public addDynamicProperty(string $dynamicName[, string $value = null ]) : mixed
Parameters
$dynamicName : string
$value : string = null
Return values
mixed —

addFillable()

Add fillable attributes for the model.

public addFillable([array<string|int, mixed>|string|null $attributes = null ]) : void
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
void —

addGlobalScope()

Register a new global scope on the model.

public static addGlobalScope(Scope|Closure|string $scope[, Closure|null $implementation = null ]) : mixed
Parameters
$scope : Scope|Closure|string
$implementation : Closure|null = null
Tags
throws
InvalidArgumentException
Return values
mixed —

addGroup()

Adds the user to the given group.

public addGroup(Group $group) : bool
Parameters
$group : Group
Return values
bool —

addHashable()

Adds an attribute to the hashable attributes list

public addHashable([array<string|int, mixed>|string|null $attributes = null ]) : $this
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
$this —

addHashableAttribute()

public addHashableAttribute(mixed $attribute) : mixed
Parameters
$attribute : mixed
Tags
deprecated

use self::addHashable() Remove this method if year >= 2018

Return values
mixed —

addHidden()

Add hidden attributes for the model.

public addHidden([array<string|int, mixed>|string|null $attributes = null ]) : void
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
void —

addJsonable()

Add jsonable attributes for the model.

public addJsonable([array<string|int, mixed>|string|null $attributes = null ]) : void
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
void —

addObservableEvents()

Add an observable event name.

public addObservableEvents(array<string|int, mixed>|mixed $observables) : void
Parameters
$observables : array<string|int, mixed>|mixed
Return values
void —

addPurgeable()

Adds an attribute to the purgeable attributes list

public addPurgeable([array<string|int, mixed>|string|null $attributes = null ]) : $this
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
$this —

addVisible()

Add visible attributes for the model.

public addVisible([array<string|int, mixed>|string|null $attributes = null ]) : void
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
void —

afterCreate()

After create event

public afterCreate() : void
Return values
void —

afterDelete()

After delete event

public afterDelete() : void
Return values
void —

afterLogin()

After login event

public afterLogin() : void
Return values
void —

all()

public static all(mixed $columns) :
Parameters
$columns : mixed
Return values
—

all()

Get all of the models from the database.

public static all([array<string|int, mixed>|mixed $columns = ['*'] ]) : Collection|array<string|int, static>
Parameters
$columns : array<string|int, mixed>|mixed = ['*']
Return values
Collection|array<string|int, static> —

alwaysPush()

Pushes the first level of relations even if the parent model has no changes.

public alwaysPush(array<string|int, mixed> $options, string $sessionKey) : bool
Parameters
$options : array<string|int, mixed>
$sessionKey : string
Return values
bool —

append()

Append attributes to query when building a query.

public append(array<string|int, mixed>|string $attributes) : $this
Parameters
$attributes : array<string|int, mixed>|string
Return values
$this —

asExtension()

Short hand for `getClassExtension()` method, except takes the short extension name, example:

public asExtension(string $shortName) : mixed

$this->asExtension('FormController')

Parameters
$shortName : string
Return values
mixed —

attachMany()

Define an attachment one-to-many relationship.

public attachMany(mixed $related[, mixed $isPublic = null ][, mixed $localKey = null ][, mixed $relationName = null ]) : MorphMany

This code is a duplicate of Eloquent but uses a Rain relation class.

Parameters
$related : mixed
$isPublic : mixed = null
$localKey : mixed = null
$relationName : mixed = null
Return values
MorphMany —

attachOne()

Define an attachment one-to-one relationship.

public attachOne(mixed $related[, mixed $isPublic = true ][, mixed $localKey = null ][, mixed $relationName = null ]) : MorphOne

This code is a duplicate of Eloquent but uses a Rain relation class.

Parameters
$related : mixed
$isPublic : mixed = true
$localKey : mixed = null
$relationName : mixed = null
Return values
MorphOne —

attemptActivation()

Sends the confirmation email to a user, after activating.

public attemptActivation(string $code) : bool
Parameters
$code : string
Return values
bool —

attemptResetPassword()

Attempts to reset a user's password by matching the reset code generated with the user's.

public attemptResetPassword(string $resetCode, string $newPassword) : bool
Parameters
$resetCode : string
$newPassword : string
Return values
bool —

attributesToArray()

Convert the model's attributes to an array.

public attributesToArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —

ban()

Ban this user, preventing them from signing in.

public ban() : void
Return values
void —

beforeLogin()

Before login event

public beforeLogin() : void
Return values
void —

beforeValidate()

Before validation event

public beforeValidate() : void
Return values
void —

belongsTo()

Define an inverse one-to-one or many relationship.

public belongsTo(string $related[, string $foreignKey = null ][, string $ownerKey = null ][, string $relation = null ]) : BelongsTo
Parameters
$related : string
$foreignKey : string = null
$ownerKey : string = null
$relation : string = null
Return values
BelongsTo —

belongsToMany()

Define a many-to-many relationship.

public belongsToMany(string $related[, string $table = null ][, string $foreignPivotKey = null ][, string $relatedPivotKey = null ][, string $parentKey = null ][, string $relatedKey = null ][, string $relation = null ]) : BelongsToMany
Parameters
$related : string
$table : string = null
$foreignPivotKey : string = null
$relatedPivotKey : string = null
$parentKey : string = null
$relatedKey : string = null
$relation : string = null
Return values
BelongsToMany —

bindDeferred()

Bind a deferred relationship to the supplied record.

public bindDeferred(mixed $relation, mixed $record, mixed $sessionKey) : mixed
Parameters
$relation : mixed
$record : mixed
$sessionKey : mixed
Return values
mixed —

bindEvent()

Create a new event binding.

public bindEvent(mixed $event, mixed $callback, mixed $priority) : self
Parameters
$event : mixed
$callback : mixed
$priority : mixed
Return values
self —

bindEventOnce()

Create a new event binding that fires once only

public bindEventOnce(mixed $event, mixed $callback) : self
Parameters
$event : mixed
$callback : mixed
Return values
self —

bootHashable()

Boot the hashable trait for a model.

public static bootHashable() : void
Return values
void —

bootPurgeable()

Boot the purgeable trait for a model.

public static bootPurgeable() : void
Return values
void —

bootSoftDelete()

Boot the soft deleting trait for a model.

public static bootSoftDelete() : void
Return values
void —

bootValidation()

Boot the validation trait for this model.

public static bootValidation() : void
Return values
void —

cacheMutatedAttributes()

Extract and cache all the mutated attributes of a class.

public static cacheMutatedAttributes(string $class) : void
Parameters
$class : string
Return values
void —

cancelDeferred()

Cancel all deferred bindings to this model.

public cancelDeferred(mixed $sessionKey) : mixed
Parameters
$sessionKey : mixed
Return values
mixed —

checkHashValue()

Checks if the supplied plain value matches the stored hash value.

public checkHashValue(string $key, string $value) : bool
Parameters
$key : string

Attribute to check

$value : string

Value to check

Return values
bool —

checkPassword()

Checks the password passed matches the user's password.

public checkPassword(string $password) : bool
Parameters
$password : string
Return values
bool —

checkPersistCode()

Checks the given persist code.

public checkPersistCode(string $persistCode) : bool
Parameters
$persistCode : string
Return values
bool —

checkResetPasswordCode()

Checks if the provided user reset password code is valid without actually resetting the password.

public checkResetPasswordCode(string $resetCode) : bool
Parameters
$resetCode : string
Return values
bool —

clearBootedModels()

Clear the list of booted models so they will be re-booted.

public static clearBootedModels() : void
Return values
void —

clearExtendedClasses()

Clear the list of extended classes so they will be re-extended.

public static clearExtendedClasses() : void
Return values
void —

clearResetPassword()

Wipes out the data associated with resetting a password.

public clearResetPassword() : void
Return values
void —

commitDeferred()

Commit all deferred bindings to this model.

public commitDeferred(mixed $sessionKey) : mixed
Parameters
$sessionKey : mixed
Return values
mixed —

convertToRegistered()

Converts a guest user to a registered one and sends an invitation notification.

public convertToRegistered([mixed $sendNotification = true ]) : void
Parameters
$sendNotification : mixed = true
Return values
void —

create()

Save a new model and return the instance.

public static create([array<string|int, mixed> $attributes = [] ][, string $sessionKey = null ]) : Model|static
Parameters
$attributes : array<string|int, mixed> = []
$sessionKey : string = null
Return values
Model|static —

created()

Register a created model event with the dispatcher.

public static created(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

creating()

Register a creating model event with the dispatcher.

public static creating(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

delete()

Delete the model from the database.

public delete() : bool|null
Tags
throws
Exception
Return values
bool|null —

deleted()

Register a deleted model event with the dispatcher.

public static deleted(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

deleting()

Register a deleting model event with the dispatcher.

public static deleting(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

destroy()

Destroy the models for the given IDs.

public static destroy(array<string|int, mixed>|int $ids) : int
Parameters
$ids : array<string|int, mixed>|int
Return values
int —

extend()

Extend this object properties upon construction.

public static extend(Closure $callback) : mixed
Parameters
$callback : Closure
Return values
mixed —

extendableCall()

Magic method for `__call()`

public extendableCall(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
$name : string
$params : array<string|int, mixed> = null
Return values
mixed —

extendableCallStatic()

Magic method for `__callStatic()`

public static extendableCallStatic(string $name[, array<string|int, mixed> $params = null ]) : mixed
Parameters
$name : string
$params : array<string|int, mixed> = null
Return values
mixed —

extendableConstruct()

This method should be called as part of the constructor.

public extendableConstruct() : mixed
Return values
mixed —

extendableExtendCallback()

Helper method for `::extend()` static method

public static extendableExtendCallback(callable $callback) : void
Parameters
$callback : callable
Return values
void —

extendableGet()

Magic method for `__get()`

public extendableGet(string $name) : string
Parameters
$name : string
Return values
string —

extendableSet()

Magic method for `__set()`

public extendableSet(string $name, string $value) : string
Parameters
$name : string
$value : string
Return values
string —

extendClassWith()

Dynamically extend a class with a specified behavior

public extendClassWith(string $extensionName) : void
Parameters
$extensionName : string
Return values
void —

fetched()

Create a new native event for handling afterFetch().

public static fetched(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

fetching()

Create a new native event for handling beforeFetch().

public static fetching(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

fill()

Fill the model with an array of attributes.

public fill(array<string|int, mixed> $attributes) : $this
Parameters
$attributes : array<string|int, mixed>
Tags
throws
MassAssignmentException
Return values
$this —

fillable()

Set the fillable attributes for the model.

public fillable(array<string|int, mixed> $fillable) : $this
Parameters
$fillable : array<string|int, mixed>
Return values
$this —

fillJsonAttribute()

Set a given JSON attribute on the model.

public fillJsonAttribute(string $key, mixed $value) : $this
Parameters
$key : string
$value : mixed
Return values
$this —

filterByGroup()

public static filterByGroup(mixed $filter) :
Parameters
$filter : mixed
Return values
—

findByEmail()

Looks up a user by their email address.

public static findByEmail(mixed $email) : self
Parameters
$email : mixed
Return values
self —

fireEvent()

Fire an event and call the listeners.

public fireEvent(string $event[, array<string|int, mixed> $params = [] ][, bool $halt = false ]) : array<string|int, mixed>
Parameters
$event : string

Event name

$params : array<string|int, mixed> = []

Event parameters

$halt : bool = false

Halt after first non-null result

Return values
array<string|int, mixed> —

Collection of event results / Or single result (if halted)

flushDuplicateCache()

Flush the memory cache.

public static flushDuplicateCache() : void
Return values
void —

flushEventListeners()

Remove all of the event listeners for the model.

public static flushEventListeners() : void
Return values
void —

forceDelete()

Force a hard delete on a soft deleted model.

public forceDelete() : bool|null

This method protects developers from running forceDelete when trait is missing.

Return values
bool|null —

forceFill()

Fill the model with an array of attributes. Force mass assignment.

public forceFill(array<string|int, mixed> $attributes) : $this
Parameters
$attributes : array<string|int, mixed>
Return values
$this —

forceSave()

Force save the model even if validation fails.

public forceSave([mixed $options = null ][, mixed $sessionKey = null ]) : bool
Parameters
$options : mixed = null
$sessionKey : mixed = null
Return values
bool —

fresh()

Reload a fresh model instance from the database.

public fresh([array<string|int, mixed>|string $with = [] ]) : static|null
Parameters
$with : array<string|int, mixed>|string = []
Return values
static|null —

freshTimestampString()

Get a fresh timestamp for the model.

public freshTimestampString() : string
Return values
string —

fromDateTime()

Convert a DateTime to a storable string.

public fromDateTime(DateTime|int $value) : string
Parameters
$value : DateTime|int
Return values
string —

fromJson()

Decode the given JSON back into an array or object.

public fromJson(string $value[, bool $asObject = false ]) : mixed
Parameters
$value : string
$asObject : bool = false
Return values
mixed —

get()

public static get(mixed $columns) :
Parameters
$columns : mixed
Return values
—

getActivationCode()

Get an activation code for the given user.

public getActivationCode() : string
Return values
string —

getActualClassNameForMorph()

Retrieve the actual class name for a given morph class.

public static getActualClassNameForMorph(string $class) : string
Parameters
$class : string
Return values
string —

getAttribute()

Get an attribute from the model.

public getAttribute(string $key) : mixed
Parameters
$key : string
Return values
mixed —

getAttributes()

Get all of the current attributes on the model.

public getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getAttributeValue()

Get a plain attribute (not a relationship).

public getAttributeValue(string $key) : mixed
Parameters
$key : string
Return values
mixed —

getAuthIdentifier()

Get the unique identifier for the user.

public getAuthIdentifier() : mixed
Return values
mixed —

getAuthIdentifierName()

Get the name of the unique identifier for the user.

public getAuthIdentifierName() : string
Return values
string —

getAuthPassword()

Get the password for the user.

public getAuthPassword() : string
Return values
string —

getAvatarThumb()

Returns the public image file path to this user's avatar.

public getAvatarThumb([mixed $size = 25 ][, mixed $options = null ]) : mixed
Parameters
$size : mixed = 25
$options : mixed = null
Return values
mixed —

getCasts()

Get the casts array.

public getCasts() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getChanges()

Get the attributes that were changed.

public getChanges() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getClassExtension()

Returns a behavior object from an extendable class, example:

public getClassExtension(string $name) : mixed

$this->getClassExtension('Backend.Behaviors.FormController')

Parameters
$name : string

Fully qualified behavior name

Return values
mixed —

getClassMethods()

Get a list of class methods, extension equivalent of get_class_methods()

public getClassMethods() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getConnectionName()

Get the current connection name for the model.

public getConnectionName() : string
Return values
string —

getCreatedAtColumn()

Get the name of the "created at" column.

public getCreatedAtColumn() : string
Return values
string —

getDates()

Get the attributes that should be converted to dates.

public getDates() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getDeletedAtColumn()

Get the name of the "deleted at" column.

public getDeletedAtColumn() : string
Return values
string —

getDirty()

Get the attributes that have been changed since last sync.

public getDirty() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getDynamicProperties()

Returns all dynamic properties and their values

public getDynamicProperties() : array<string|int, mixed>
Return values
array<string|int, mixed> —

['property' => 'value']

getFillable()

Get the fillable attributes for the model.

public getFillable() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getForeignKey()

Get the default foreign key name for the model.

public getForeignKey() : string
Return values
string —

getGlobalScope()

Get a global scope registered with the model.

public static getGlobalScope(Scope|string $scope) : Scope|Closure|null
Parameters
$scope : Scope|string
Return values
Scope|Closure|null —

getGlobalScopes()

Get the global scopes for this class instance.

public getGlobalScopes() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getGroups()

Returns an array of groups which the given user belongs to.

public getGroups() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getGuarded()

Get the guarded attributes for the model.

public getGuarded() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getHashableAttributes()

Returns a collection of fields that will be hashed.

public getHashableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getHidden()

Get the hidden attributes for the model.

public getHidden() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getIncrementing()

Get the value indicating whether the IDs are incrementing.

public getIncrementing() : bool
Return values
bool —

getIsActivatedAttribute()

Get mutator for giving the activated property.

public getIsActivatedAttribute(mixed $activated) : bool
Parameters
$activated : mixed
Return values
bool —

getJsonable()

Get the jsonable attributes name

public getJsonable() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getKey()

Get the value of the model's primary key.

public getKey() : mixed
Return values
mixed —

getKeyName()

Get the primary key for the model.

public getKeyName() : string
Return values
string —

getKeyType()

Get the auto-incrementing key type.

public getKeyType() : string
Return values
string —

getLastSeen()

Returns the date this user was last seen.

public getLastSeen() : Carbon
Return values
Carbon —

getLogin()

public getLogin() : mixed
Return values
mixed —

Returns the user's login.

getLoginName()

Returns the name for the user's login.

public getLoginName() : string
Return values
string —

getMergedPermissions()

Returns an array of merged permissions for each group the user is in.

public getMergedPermissions() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getMinPasswordLength()

Returns the minimum length for a new password from settings.

public static getMinPasswordLength() : int
Return values
int —

getMorphClass()

Get the class name for polymorphic relations.

public getMorphClass() : string
Return values
string —

getMutatedAttributes()

Get the mutated attributes for a given instance.

public getMutatedAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getNotificationVars()

Returns the variables available when sending a user notification.

public getNotificationVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getObservableEvents()

Get the observable event names.

public getObservableEvents() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getOriginal()

Get the model's original attribute values.

public getOriginal([string|null $key = null ][, mixed $default = null ]) : mixed|array<string|int, mixed>
Parameters
$key : string|null = null
$default : mixed = null
Return values
mixed|array<string|int, mixed> —

getOriginalHashValue()

Returns the original values of any hashed attributes.

public getOriginalHashValue(mixed $attribute) : mixed
Parameters
$attribute : mixed
Return values
mixed —

getOriginalHashValues()

Returns the original values of any hashed attributes.

public getOriginalHashValues() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getOriginalPurgeValue()

Returns the original values of any purged attributes.

public getOriginalPurgeValue(mixed $attribute) : mixed
Parameters
$attribute : mixed
Return values
mixed —

getOriginalPurgeValues()

Returns the original values of any purged attributes.

public getOriginalPurgeValues() : mixed
Return values
mixed —

getPerPage()

Get the number of models to return per page.

public getPerPage() : int
Return values
int —

getPersistCode()

Gets a code for when the user is persisted to a cookie or session which identifies the user.

public getPersistCode() : string
Return values
string —

getPurgeableAttributes()

Returns a collection of fields that will be hashed.

public getPurgeableAttributes() : mixed
Return values
mixed —

getQualifiedDeletedAtColumn()

Get the fully qualified "deleted at" column.

public getQualifiedDeletedAtColumn() : string
Return values
string —

getQualifiedKeyName()

Get the table qualified key name.

public getQualifiedKeyName() : string
Return values
string —

getQueueableConnection()

Get the queueable connection for the entity.

public getQueueableConnection() : mixed
Return values
mixed —

getQueueableId()

Get the queueable identity for the entity.

public getQueueableId() : mixed
Return values
mixed —

getRandomString()

Generate a random string

public getRandomString([mixed $length = 42 ]) : string
Parameters
$length : mixed = 42
Return values
string —

getRelation()

Get a specified relationship.

public getRelation(string $relation) : mixed
Parameters
$relation : string
Return values
mixed —

getRelationDefinition()

Returns relationship details from a supplied name.

public getRelationDefinition(string $name) : array<string|int, mixed>
Parameters
$name : string

Relation name

Return values
array<string|int, mixed> —

getRelationDefinitions()

Returns relationship details for all relations defined on this model.

public getRelationDefinitions() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getRelations()

Get all the loaded relations for the instance.

public getRelations() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getRelationType()

Returns a relationship type based on a supplied name.

public getRelationType(string $name) : string
Parameters
$name : string

Relation name

Return values
string —

getRelationValue()

Get a relationship.

public getRelationValue(string $key) : mixed
Parameters
$key : string
Return values
mixed —

getRememberToken()

Get the token value for the "remember me" session.

public getRememberToken() : string
Return values
string —

getRememberTokenName()

Get the column name for the "remember me" token.

public getRememberTokenName() : string
Return values
string —

getReminderEmail()

Get the e-mail address where password reminders are sent.

public getReminderEmail() : string
Return values
string —

getResetPasswordCode()

Get a reset password code for the given user.

public getResetPasswordCode() : string
Return values
string —

getRole()

Returns the role assigned to this user.

public getRole() : Role
Return values
Role —

getRouteKey()

Get the value of the model's route key.

public getRouteKey() : mixed
Return values
mixed —

getRouteKeyName()

Get the route key for the model.

public getRouteKeyName() : string
Return values
string —

getTable()

Get the table associated with the model.

public getTable() : string
Return values
string —

getTouchedRelations()

Get the relationships that are touched on save.

public getTouchedRelations() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getUpdatedAtColumn()

Get the name of the "updated at" column.

public getUpdatedAtColumn() : string
Return values
string —

getVisible()

Get the visible attributes for the model.

public getVisible() : array<string|int, mixed>
Return values
array<string|int, mixed> —

guard()

Set the guarded attributes for the model.

public guard(array<string|int, mixed> $guarded) : $this
Parameters
$guarded : array<string|int, mixed>
Return values
$this —

hasAccess()

See if a user has access to the passed permission(s).

public hasAccess(string|array<string|int, mixed> $permissions[, bool $all = true ]) : bool

Permissions are merged from all groups the user belongs to and then are checked against the passed permission(s).

If multiple permissions are passed, the user must have access to all permissions passed through, unless the "all" flag is set to false.

Super users have access no matter what.

Parameters
$permissions : string|array<string|int, mixed>
$all : bool = true
Return values
bool —

hasAnyAccess()

Returns if the user has access to any of the given permissions.

public hasAnyAccess(array<string|int, mixed> $permissions) : bool
Parameters
$permissions : array<string|int, mixed>
Return values
bool —

hasCast()

Determine whether an attribute should be cast to a native type.

public hasCast(string $key[, array<string|int, mixed>|string|null $types = null ]) : bool
Parameters
$key : string
$types : array<string|int, mixed>|string|null = null
Return values
bool —

hasGetMutator()

Determine if a get mutator exists for an attribute.

public hasGetMutator(string $key) : bool
Parameters
$key : string
Return values
bool —

hasGlobalScope()

Determine if a model has a global scope.

public static hasGlobalScope(Scope|string $scope) : bool
Parameters
$scope : Scope|string
Return values
bool —

hasMany()

Define a one-to-many relationship.

public hasMany(string $related[, string $foreignKey = null ][, string $localKey = null ]) : HasMany
Parameters
$related : string
$foreignKey : string = null
$localKey : string = null
Return values
HasMany —

hasManyThrough()

Define a has-many-through relationship.

public hasManyThrough(string $related, string $through[, string|null $firstKey = null ][, string|null $secondKey = null ][, string|null $localKey = null ][, string|null $secondLocalKey = null ]) : HasManyThrough
Parameters
$related : string
$through : string
$firstKey : string|null = null
$secondKey : string|null = null
$localKey : string|null = null
$secondLocalKey : string|null = null
Return values
HasManyThrough —

hasOne()

Define a one-to-one relationship.

public hasOne(string $related[, string $foreignKey = null ][, string $localKey = null ]) : HasOne
Parameters
$related : string
$foreignKey : string = null
$localKey : string = null
Return values
HasOne —

hasPermission()

See if a user has access to the passed permission(s).

public hasPermission(string|array<string|int, mixed> $permissions[, bool $all = true ]) : bool

Permissions are merged from all groups the user belongs to and then are checked against the passed permission(s).

If multiple permissions are passed, the user must have access to all permissions passed through, unless the "all" flag is set to false.

Super users DON'T have access no matter what.

Parameters
$permissions : string|array<string|int, mixed>
$all : bool = true
Return values
bool —

hasRelation()

Checks if model has a relationship by supplied name.

public hasRelation(string $name) : bool
Parameters
$name : string

Relation name

Return values
bool —

hasSetMutator()

Determine if a set mutator exists for an attribute.

public hasSetMutator(string $key) : bool
Parameters
$key : string
Return values
bool —

inGroup()

See if the user is in the given group.

public inGroup(Group $group) : bool
Parameters
$group : Group
Return values
bool —

is()

Determine if two models have the same ID and belong to the same table.

public is(Model|null $model) : bool
Parameters
$model : Model|null
Return values
bool —

isActivated()

public static isActivated() :
Return values
—

isAttributeRequired()

Determines if an attribute is required based on the validation rules.

public isAttributeRequired(string $attribute[, bool $checkDependencies = true ]) : bool
Parameters
$attribute : string
$checkDependencies : bool = true

Checks the attribute dependencies (for required_if & required_with rules). Note that it will only be checked up to the next level, if another dependent rule is found then it will just assume the field is required

Return values
bool —

isBanned()

Check if the user is banned.

public isBanned() : bool
Return values
bool —

isClassExtendedWith()

Check if extendable class is extended with a behavior object

public isClassExtendedWith(string $name) : bool
Parameters
$name : string

Fully qualified behavior name

Return values
bool —

isClean()

Determine if the model or given attribute(s) have remained the same.

public isClean([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
bool —

isDeferrable()

Returns true if a relation exists and can be deferred.

public isDeferrable(mixed $relationName) : mixed
Parameters
$relationName : mixed
Return values
mixed —

isDirty()

Determine if the model or given attribute(s) have been modified.

public isDirty([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
bool —

isFillable()

Determine if the given attribute may be mass assigned.

public isFillable(string $key) : bool
Parameters
$key : string
Return values
bool —

isGuarded()

Determine if the given key is guarded.

public isGuarded(string $key) : bool
Parameters
$key : string
Return values
bool —

isJsonable()

Checks if an attribute is jsonable or not.

public isJsonable(mixed $key) : array<string|int, mixed>
Parameters
$key : mixed
Return values
array<string|int, mixed> —

isNot()

Determine if two models are not the same.

public isNot(Model|null $model) : bool
Parameters
$model : Model|null
Return values
bool —

isOnline()

Returns true if the user has been active within the last 5 minutes.

public isOnline() : bool
Return values
bool —

isRegisterThrottled()

Returns true if IP address is throttled and cannot register again. Maximum 3 registrations every 60 minutes.

public static isRegisterThrottled(string|null $ipAddress) : bool
Parameters
$ipAddress : string|null
Return values
bool —

isRelationPushable()

Determines whether the specified relation should be saved when push() is called instead of save() on the model. Default: true.

public isRelationPushable(string $name) : bool
Parameters
$name : string

Relation name

Return values
bool —

isSoftDelete()

Helper method to check if the model is currently being hard or soft deleted, useful in events.

public isSoftDelete() : bool
Return values
bool —

isSuperUser()

Checks if the user is a super user - has access to everything regardless of permissions.

public isSuperUser() : bool
Return values
bool —

isSuspended()

Check if the user is suspended.

public isSuspended() : bool
Return values
bool —

isUnguarded()

Determine if current state is "unguarded".

public static isUnguarded() : bool
Return values
bool —

joiningTable()

Get the joining table name for a many-to-many relation.

public joiningTable(string $related) : string
Parameters
$related : string
Return values
string —

jsonable()

Set the jsonable attributes for the model.

public jsonable(array<string|int, mixed> $jsonable) : $this
Parameters
$jsonable : array<string|int, mixed>
Return values
$this —

jsonSerialize()

Convert the object into something JSON serializable.

public jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —

load()

Eager load relations on the model.

public load(array<string|int, mixed>|string $relations) : $this
Parameters
$relations : array<string|int, mixed>|string
Return values
$this —

loadMissing()

Eager load relations on the model if they are not already eager loaded.

public loadMissing(array<string|int, mixed>|string $relations) : $this
Parameters
$relations : array<string|int, mixed>|string
Return values
$this —

make()

Create a new model and return the instance.

public static make([array<string|int, mixed> $attributes = [] ]) : Model|static
Parameters
$attributes : array<string|int, mixed> = []
Return values
Model|static —

makeHashValue()

Hashes an attribute value and saves it in the original locker.

public makeHashValue(string $key, string $value) : string
Parameters
$key : string

Attribute

$value : string

Value to hash

Return values
string —

Hashed value

makeHidden()

Make the given, typically visible, attributes hidden.

public makeHidden(array<string|int, mixed>|string $attributes) : $this
Parameters
$attributes : array<string|int, mixed>|string
Return values
$this —

makeRelation()

Returns a relation class object

public makeRelation(string $name) : string
Parameters
$name : string

Relation name

Return values
string —

makeVisible()

Make the given, typically hidden, attributes visible.

public makeVisible(array<string|int, mixed>|string $attributes) : $this
Parameters
$attributes : array<string|int, mixed>|string
Return values
$this —

methodExists()

Checks if a method exists, extension equivalent of method_exists()

public methodExists(string $name) : bool
Parameters
$name : string
Return values
bool —

morphedByMany()

Define a polymorphic, inverse many-to-many relationship.

public morphedByMany(string $related, string $name[, string $table = null ][, string $foreignPivotKey = null ][, string $relatedPivotKey = null ][, string $parentKey = null ][, string $relatedKey = null ]) : MorphToMany
Parameters
$related : string
$name : string
$table : string = null
$foreignPivotKey : string = null
$relatedPivotKey : string = null
$parentKey : string = null
$relatedKey : string = null
Return values
MorphToMany —

morphMany()

Define a polymorphic one-to-many relationship.

public morphMany(string $related, string $name[, string $type = null ][, string $id = null ][, string $localKey = null ]) : MorphMany
Parameters
$related : string
$name : string
$type : string = null
$id : string = null
$localKey : string = null
Return values
MorphMany —

morphOne()

Define a polymorphic one-to-one relationship.

public morphOne(string $related, string $name[, string $type = null ][, string $id = null ][, string $localKey = null ]) : MorphOne
Parameters
$related : string
$name : string
$type : string = null
$id : string = null
$localKey : string = null
Return values
MorphOne —

morphTo()

Define a polymorphic, inverse one-to-one or many relationship.

public morphTo([string $name = null ][, string $type = null ][, string $id = null ]) : MorphTo
Parameters
$name : string = null
$type : string = null
$id : string = null
Return values
MorphTo —

morphToMany()

Define a polymorphic many-to-many relationship.

public morphToMany(string $related, string $name[, string $table = null ][, string $foreignPivotKey = null ][, string $relatedPivotKey = null ][, string $parentKey = null ][, string $relatedKey = null ][, bool $inverse = false ]) : MorphToMany
Parameters
$related : string
$name : string
$table : string = null
$foreignPivotKey : string = null
$relatedPivotKey : string = null
$parentKey : string = null
$relatedKey : string = null
$inverse : bool = false
Return values
MorphToMany —

newCollection()

Create a new Eloquent Collection instance.

public newCollection([array<string|int, mixed> $models = [] ]) : Collection
Parameters
$models : array<string|int, mixed> = []
Return values
Collection —

newEloquentBuilder()

Create a new Eloquent query builder for the model.

public newEloquentBuilder(Builder $query) : Builder|static
Parameters
$query : Builder
Return values
Builder|static —

newFromBuilder()

Create a new model instance that is existing.

public newFromBuilder([array<string|int, mixed> $attributes = [] ][, string|null $connection = null ]) : static
Parameters
$attributes : array<string|int, mixed> = []
$connection : string|null = null
Return values
static —

newInstance()

Create a new instance of the given model.

public newInstance([array<string|int, mixed> $attributes = [] ][, bool $exists = false ]) : static
Parameters
$attributes : array<string|int, mixed> = []
$exists : bool = false
Return values
static —

newModelQuery()

Get a new query builder that doesn't have any global scopes or eager loading.

public newModelQuery() : Builder|static
Return values
Builder|static —

newModelQuery()

public static newModelQuery() :
Return values
—

newPivot()

Create a new pivot model instance.

public newPivot(Model $parent, array<string|int, mixed> $attributes, string $table, bool $exists[, string|null $using = null ]) : Pivot
Parameters
$parent : Model
$attributes : array<string|int, mixed>
$table : string
$exists : bool
$using : string|null = null
Return values
Pivot —

newQuery()

public static newQuery() :
Return values
—

newQuery()

Get a new query builder for the model's table.

public newQuery() : Builder
Return values
Builder —

newQueryForRestoration()

Get a new query to restore one or more models by their queueable IDs.

public newQueryForRestoration(array<string|int, mixed>|int $ids) : Builder
Parameters
$ids : array<string|int, mixed>|int
Return values
Builder —

newQueryWithoutRelationships()

Get a new query builder with no relationships loaded.

public newQueryWithoutRelationships() : Builder
Return values
Builder —

newQueryWithoutScope()

Get a new query instance without a given scope.

public newQueryWithoutScope(Scope|string $scope) : Builder
Parameters
$scope : Scope|string
Return values
Builder —

newQueryWithoutScopes()

Get a new query builder that doesn't have any global scopes.

public newQueryWithoutScopes() : Builder|static
Return values
Builder|static —

newRelationPivot()

Create a pivot model instance specific to a relation.

public newRelationPivot(string $relationName, Model $parent, array<string|int, mixed> $attributes, string $table, bool $exists) : Pivot
Parameters
$relationName : string
$parent : Model
$attributes : array<string|int, mixed>
$table : string
$exists : bool
Return values
Pivot —

observe()

Register an observer with the Model.

public static observe(object|string $class) : void
Parameters
$class : object|string
Return values
void —

offsetExists()

Determine if the given attribute exists.

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool —

offsetGet()

Get the value for a given offset.

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed
Return values
mixed —

offsetSet()

Set the value for a given offset.

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed
Return values
void —

offsetUnset()

Unset the value for a given offset.

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed
Return values
void —

on()

Begin querying the model on a given connection.

public static on([string|null $connection = null ]) : Builder
Parameters
$connection : string|null = null
Return values
Builder —

only()

Get a subset of the model's attributes.

public only(array<string|int, mixed>|mixed $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>|mixed
Return values
array<string|int, mixed> —

onlyTrashed()

Get a new query builder that only includes soft deletes.

public static onlyTrashed() : Builder|static
Return values
Builder|static —

onWriteConnection()

Begin querying the model on the write connection.

public static onWriteConnection() : Builder
Return values
Builder —

propertyExists()

Checks if a property exists, extension equivalent of `property_exists()`

public propertyExists(string $name) : bool
Parameters
$name : string
Return values
bool —

purgeAttributes()

Removes purged attributes from the dataset, used before saving.

public purgeAttributes([mixed $attributesToPurge = null ]) : array<string|int, mixed>
Parameters
$attributesToPurge : mixed = null
Return values
array<string|int, mixed> —

Current attribute set

push()

Save the model and all of its relationships.

public push() : bool
Return values
bool —

qualifyColumn()

Qualify the given column name by the model's table.

public qualifyColumn(string $column) : string
Parameters
$column : string
Return values
string —

query()

public static query() :
Return values
—

refresh()

Reload the current model instance with fresh attributes from the database.

public refresh() : $this
Return values
$this —

registerGlobalScopes()

Register the global scopes for this builder instance.

public registerGlobalScopes(Builder $builder) : Builder
Parameters
$builder : Builder
Return values
Builder —

reguard()

Enable the mass assignment restrictions.

public static reguard() : void
Return values
void —

relationLoaded()

Determine if the given relation is loaded.

public relationLoaded(string $key) : bool
Parameters
$key : string
Return values
bool —

relationsToArray()

Get the model's relationships in array form.

public relationsToArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —

reload()

Reloads the model attributes from the database.

public reload() : Model|static
Return values
Model|static —

reloadRelations()

Reloads the model relationship cache.

public reloadRelations([string $relationName = null ]) : void
Parameters
$relationName : string = null
Return values
void —

removeGroup()

Removes the user from the given group.

public removeGroup(Group $group) : bool
Parameters
$group : Group
Return values
bool —

removeObservableEvents()

Remove an observable event name.

public removeObservableEvents(array<string|int, mixed>|mixed $observables) : void
Parameters
$observables : array<string|int, mixed>|mixed
Return values
void —

replicate()

Clone the model into a new, non-existing instance.

public replicate([array<string|int, mixed>|null $except = null ]) : Model
Parameters
$except : array<string|int, mixed>|null = null
Return values
Model —

resolveConnection()

Resolve a connection instance.

public static resolveConnection([string|null $connection = null ]) : Connection
Parameters
$connection : string|null = null
Return values
Connection —

resolveRouteBinding()

Retrieve the model for a bound value.

public resolveRouteBinding(mixed $value) : Model|null
Parameters
$value : mixed
Return values
Model|null —

restore()

Restore a soft-deleted model instance.

public restore() : bool|null
Return values
bool|null —

restored()

Register a restored model event with the dispatcher.

public static restored(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

restorePurgedValues()

Restores the original values of any purged attributes.

public restorePurgedValues() : mixed
Return values
mixed —

restoring()

Register a restoring model event with the dispatcher.

public static restoring(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

retrieved()

Register a retrieved model event with the dispatcher.

public static retrieved(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

save()

Save the model to the database.

public save([array<string|int, mixed> $options = [] ]) : bool
Parameters
$options : array<string|int, mixed> = []
Return values
bool —

saved()

Register a saved model event with the dispatcher.

public static saved(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

saveOrFail()

Save the model to the database using transaction.

public saveOrFail([array<string|int, mixed> $options = [] ]) : bool
Parameters
$options : array<string|int, mixed> = []
Tags
throws
Throwable
Return values
bool —

saving()

Register a saving model event with the dispatcher.

public static saving(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

scopeFilterByGroup()

public scopeFilterByGroup(mixed $query, mixed $filter) : mixed
Parameters
$query : mixed
$filter : mixed
Return values
mixed —

scopeIsActivated()

public scopeIsActivated(mixed $query) : mixed
Parameters
$query : mixed
Return values
mixed —

setAppends()

Set the accessors to append to model arrays.

public setAppends(array<string|int, mixed> $appends) : $this
Parameters
$appends : array<string|int, mixed>
Return values
$this —

setAttribute()

Set a given attribute on the model.

public setAttribute(string $key, mixed $value) : $this
Parameters
$key : string
$value : mixed
Return values
$this —

setConnection()

Set the connection associated with the model.

public setConnection(string $name) : $this
Parameters
$name : string
Return values
$this —

setCreatedAt()

Set the value of the "created at" attribute.

public setCreatedAt(mixed $value) : $this
Parameters
$value : mixed
Return values
$this —

setDateFormat()

Set the date format used by the model.

public setDateFormat(string $format) : $this
Parameters
$format : string
Return values
$this —

setEventDispatcher()

Set the event dispatcher instance.

public static setEventDispatcher(Dispatcher $dispatcher) : void
Parameters
$dispatcher : Dispatcher
Return values
void —

setHidden()

Set the hidden attributes for the model.

public setHidden(array<string|int, mixed> $hidden) : $this
Parameters
$hidden : array<string|int, mixed>
Return values
$this —

setIncrementing()

Set whether IDs are incrementing.

public setIncrementing(bool $value) : $this
Parameters
$value : bool
Return values
$this —

setKeyName()

Set the primary key for the model.

public setKeyName(string $key) : $this
Parameters
$key : string
Return values
$this —

setKeyType()

Set the data type for the primary key.

public setKeyType(string $type) : $this
Parameters
$type : string
Return values
$this —

setObservableEvents()

Set the observable event names.

public setObservableEvents(array<string|int, mixed> $observables) : $this
Parameters
$observables : array<string|int, mixed>
Return values
$this —

setPasswordAttribute()

Protects the password from being reset to null.

public setPasswordAttribute(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed —

setPermissionsAttribute()

Validate any set permissions.

public setPermissionsAttribute(array<string|int, mixed> $permissions) : void
Parameters
$permissions : array<string|int, mixed>
Return values
void —

setPerPage()

Set the number of models to return per page.

public setPerPage(int $perPage) : $this
Parameters
$perPage : int
Return values
$this —

setRawAttributes()

Set the array of model attributes. No checking is done.

public setRawAttributes(array<string|int, mixed> $attributes[, bool $sync = false ]) : $this
Parameters
$attributes : array<string|int, mixed>
$sync : bool = false
Return values
$this —

setRelation()

Set the specific relationship in the model.

public setRelation(string $relation, mixed $value) : $this
Parameters
$relation : string
$value : mixed
Return values
$this —

setRelations()

Set the entire relations array on the model.

public setRelations(array<string|int, mixed> $relations) : $this
Parameters
$relations : array<string|int, mixed>
Return values
$this —

setRememberToken()

Set the token value for the "remember me" session.

public setRememberToken(string $value) : void
Parameters
$value : string
Return values
void —

setTable()

Set the table associated with the model.

public setTable(string $table) : $this
Parameters
$table : string
Return values
$this —

setTouchedRelations()

Set the relationships that are touched on save.

public setTouchedRelations(array<string|int, mixed> $touches) : $this
Parameters
$touches : array<string|int, mixed>
Return values
$this —

setUpdatedAt()

Set the value of the "updated at" attribute.

public setUpdatedAt(mixed $value) : $this
Parameters
$value : mixed
Return values
$this —

setValidationAttributeName()

Programatically sets the validation attribute names, will take lower priority to model defined attribute names found in `$attributeNames`.

public setValidationAttributeName(string $attr, string $name) : void
Parameters
$attr : string
$name : string
Return values
void —

setValidationAttributeNames()

Programatically sets multiple validation attribute names.

public setValidationAttributeNames(array<string|int, mixed> $attributeNames) : void
Parameters
$attributeNames : array<string|int, mixed>
Return values
void —

setVisible()

Set the visible attributes for the model.

public setVisible(array<string|int, mixed> $visible) : $this
Parameters
$visible : array<string|int, mixed>
Return values
$this —

syncChanges()

Sync the changed attributes.

public syncChanges() : $this
Return values
$this —

syncOriginal()

Sync the original attributes with the current.

public syncOriginal() : $this
Return values
$this —

syncOriginalAttribute()

Sync a single original attribute with its current value.

public syncOriginalAttribute(string $attribute) : $this
Parameters
$attribute : string
Return values
$this —

toArray()

Convert the model instance to an array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —

toJson()

Convert the model instance to JSON.

public toJson(int $options) : string
Parameters
$options : int
Tags
throws
JsonEncodingException
Return values
string —

totallyGuarded()

Determine if the model is totally guarded.

public totallyGuarded() : bool
Return values
bool —

touch()

Update the model's update timestamp.

public touch() : bool
Return values
bool —

touches()

Determine if the model touches a given relation.

public touches(string $relation) : bool
Parameters
$relation : string
Return values
bool —

touchIpAddress()

Records the last_ip_address to reflect the last known IP for this user.

public touchIpAddress(string|null $ipAddress) : void
Parameters
$ipAddress : string|null
Return values
void —

touchLastSeen()

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 values
void —

touchOwners()

Touch the owning relations of the model.

public touchOwners() : void
Return values
void —

trashed()

Determine if the model instance has been soft-deleted.

public trashed() : bool
Return values
bool —

unban()

Remove the ban on this user.

public unban() : void
Return values
void —

unbindDeferred()

Unbind a deferred relationship to the supplied record.

public unbindDeferred(mixed $relation, mixed $record, mixed $sessionKey) : mixed
Parameters
$relation : mixed
$record : mixed
$sessionKey : mixed
Return values
mixed —

unbindEvent()

Destroys an event binding.

public unbindEvent([string $event = null ]) : self
Parameters
$event : string = null

Event to destroy

Return values
self —

unguard()

Disable all mass assignable restrictions.

public static unguard([bool $state = true ]) : void
Parameters
$state : bool = true
Return values
void —

unguarded()

Run the given callable while being unguarded.

public static unguarded(callable $callback) : mixed
Parameters
$callback : callable
Return values
mixed —

unsetConnectionResolver()

Unset the connection resolver for models.

public static unsetConnectionResolver() : void
Return values
void —

unsetEventDispatcher()

Unset the event dispatcher for models.

public static unsetEventDispatcher() : void
Return values
void —

unsuspend()

Remove the suspension on this user.

public unsuspend() : void
Return values
void —

update()

Update the model in the database.

public update([array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $options = [] ]) : bool
Parameters
$attributes : array<string|int, mixed> = []
$options : array<string|int, mixed> = []
Return values
bool —

updated()

Register an updated model event with the dispatcher.

public static updated(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

updating()

Register an updating model event with the dispatcher.

public static updating(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

usesTimestamps()

Determine if the model uses timestamps.

public usesTimestamps() : bool
Return values
bool —

validate()

Validate the model instance

public validate([mixed $rules = null ][, mixed $customMessages = null ][, mixed $attributeNames = null ]) : bool
Parameters
$rules : mixed = null
$customMessages : mixed = null
$attributeNames : mixed = null
Return values
bool —

validated()

Create a new native event for handling afterValidate().

public static validated(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

validating()

Create a new native event for handling beforeValidate().

public static validating(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void —

wasChanged()

Determine if the model or given attribute(s) have been modified.

public wasChanged([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
bool —

whereActivatedAt()

public static whereActivatedAt(mixed $value) :
Parameters
$value : mixed
Return values
—

whereActivationCode()

public static whereActivationCode(mixed $value) :
Parameters
$value : mixed
Return values
—

whereCity()

public static whereCity(mixed $value) :
Parameters
$value : mixed
Return values
—

whereCompany()

public static whereCompany(mixed $value) :
Parameters
$value : mixed
Return values
—

whereCountryId()

public static whereCountryId(mixed $value) :
Parameters
$value : mixed
Return values
—

whereCreatedAt()

public static whereCreatedAt(mixed $value) :
Parameters
$value : mixed
Return values
—

whereCreatedIpAddress()

public static whereCreatedIpAddress(mixed $value) :
Parameters
$value : mixed
Return values
—

whereDeletedAt()

public static whereDeletedAt(mixed $value) :
Parameters
$value : mixed
Return values
—

whereEmail()

public static whereEmail(mixed $value) :
Parameters
$value : mixed
Return values
—

whereId()

public static whereId(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIsActivated()

public static whereIsActivated(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIsGuest()

public static whereIsGuest(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIsSuperuser()

public static whereIsSuperuser(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuAbout()

public static whereIuAbout(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuBlog()

public static whereIuBlog(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuComment()

public static whereIuComment(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuCompany()

public static whereIuCompany(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuFacebook()

public static whereIuFacebook(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuGender()

public static whereIuGender(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuIcq()

public static whereIuIcq(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuJob()

public static whereIuJob(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuSkype()

public static whereIuSkype(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuTelephone()

public static whereIuTelephone(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuTwitter()

public static whereIuTwitter(mixed $value) :
Parameters
$value : mixed
Return values
—

whereIuWebpage()

public static whereIuWebpage(mixed $value) :
Parameters
$value : mixed
Return values
—

whereLastIpAddress()

public static whereLastIpAddress(mixed $value) :
Parameters
$value : mixed
Return values
—

whereLastLogin()

public static whereLastLogin(mixed $value) :
Parameters
$value : mixed
Return values
—

whereLastSeen()

public static whereLastSeen(mixed $value) :
Parameters
$value : mixed
Return values
—

whereMobile()

public static whereMobile(mixed $value) :
Parameters
$value : mixed
Return values
—

whereName()

public static whereName(mixed $value) :
Parameters
$value : mixed
Return values
—

wherePassword()

public static wherePassword(mixed $value) :
Parameters
$value : mixed
Return values
—

wherePermissions()

public static wherePermissions(mixed $value) :
Parameters
$value : mixed
Return values
—

wherePersistCode()

public static wherePersistCode(mixed $value) :
Parameters
$value : mixed
Return values
—

wherePhone()

public static wherePhone(mixed $value) :
Parameters
$value : mixed
Return values
—

whereResetPasswordCode()

public static whereResetPasswordCode(mixed $value) :
Parameters
$value : mixed
Return values
—

whereSettings()

public static whereSettings(mixed $value) :
Parameters
$value : mixed
Return values
—

whereStateId()

public static whereStateId(mixed $value) :
Parameters
$value : mixed
Return values
—

whereStreetAddr()

public static whereStreetAddr(mixed $value) :
Parameters
$value : mixed
Return values
—

whereSurname()

public static whereSurname(mixed $value) :
Parameters
$value : mixed
Return values
—

whereTimezoneId()

public static whereTimezoneId(mixed $value) :
Parameters
$value : mixed
Return values
—

whereUpdatedAt()

public static whereUpdatedAt(mixed $value) :
Parameters
$value : mixed
Return values
—

whereUsername()

public static whereUsername(mixed $value) :
Parameters
$value : mixed
Return values
—

whereZip()

public static whereZip(mixed $value) :
Parameters
$value : mixed
Return values
—

with()

Begin querying a model with eager loading.

public static with(array<string|int, mixed>|string $relations) : Builder|static
Parameters
$relations : array<string|int, mixed>|string
Return values
Builder|static —

withTrashed()

Get a new query builder that includes soft deletes.

public static withTrashed() : Builder|static
Return values
Builder|static —

addCastAttributesToArray()

Add the casted attributes to the attributes array.

protected addCastAttributesToArray(array<string|int, mixed> $attributes, array<string|int, mixed> $mutatedAttributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
$mutatedAttributes : array<string|int, mixed>
Return values
array<string|int, mixed> —

addDateAttributesToArray()

Add the date attributes to the attributes array.

protected addDateAttributesToArray(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed> —

addMutatedAttributesToArray()

Add the mutated attributes to the attributes array.

protected addMutatedAttributesToArray(array<string|int, mixed> $attributes, array<string|int, mixed> $mutatedAttributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
$mutatedAttributes : array<string|int, mixed>
Return values
array<string|int, mixed> —

afterFetch()

Handle the "fetched" model event

protected afterFetch() : mixed
Return values
mixed —

afterSave()

Handle the "saved" model event

protected afterSave() : mixed
Return values
mixed —

afterUpdate()

Handle the "updated" model event

protected afterUpdate() : mixed
Return values
mixed —

asDate()

Return a timestamp as DateTime object with time set to 00:00:00.

protected asDate(mixed $value) : Carbon
Parameters
$value : mixed
Return values
Carbon —

asDateTime()

Return a timestamp as DateTime object.

protected asDateTime(mixed $value) : Carbon
Parameters
$value : mixed
Return values
Carbon —

asJson()

Encode the given value as JSON.

protected asJson(mixed $value) : string
Parameters
$value : mixed
Return values
string —

asTimestamp()

Return a timestamp as unix timestamp.

protected asTimestamp(mixed $value) : int
Parameters
$value : mixed
Return values
int —

beforeCreate()

Handle the "creating" model event

protected beforeCreate() : mixed
Return values
mixed —

beforeDelete()

Handle the "deleting" model event

protected beforeDelete() : mixed
Return values
mixed —

beforeFetch()

Handle the "fetching" model event

protected beforeFetch() : mixed
Return values
mixed —

beforeSave()

Handle the "saving" model event

protected beforeSave() : mixed
Return values
mixed —

beforeUpdate()

Handle the "updating" model event

protected beforeUpdate() : mixed
Return values
mixed —

boot()

The "booting" method of the model.

protected static boot() : void
Return values
void —

bootIfNotBooted()

Check if the model needs to be booted and if so, do it.

protected bootIfNotBooted() : void
Return values
void —

bootNicerEvents()

Bind some nicer events to this model, in the format of method overrides.

protected bootNicerEvents() : mixed
Return values
mixed —

bootTraits()

Boot all of the bootable traits on the model.

protected static bootTraits() : void
Return values
void —

castAttribute()

Cast an attribute to a native PHP type.

protected castAttribute(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed
Return values
mixed —

castAttributeAsJson()

Cast the given attribute to JSON.

protected castAttributeAsJson(string $key, mixed $value) : string
Parameters
$key : string
$value : mixed
Return values
string —

commitDeferredAfter()

Internally used method to commit all deferred bindings after saving.

protected commitDeferredAfter(mixed $sessionKey) : mixed
Parameters
$sessionKey : mixed
Return values
mixed —

commitDeferredBefore()

Internally used method to commit all deferred bindings before saving.

protected commitDeferredBefore(mixed $sessionKey) : mixed

It is a rare need to have to call this, since it only applies to the "belongs to" relationship which generally does not need deferring.

Parameters
$sessionKey : mixed
Return values
mixed —

commitDeferredOfType()

Internal method for committing deferred relations.

protected commitDeferredOfType(mixed $sessionKey[, mixed $include = null ][, mixed $exclude = null ]) : mixed
Parameters
$sessionKey : mixed
$include : mixed = null
$exclude : mixed = null
Return values
mixed —

decrement()

Decrement a column's value by a given amount.

protected decrement(string $column[, int $amount = 1 ][, array<string|int, mixed> $extra = [] ]) : int
Parameters
$column : string
$amount : int = 1
$extra : array<string|int, mixed> = []
Return values
int —

emitterEventSortEvents()

Sort the listeners for a given event by priority.

protected emitterEventSortEvents(string $eventName) : array<string|int, mixed>
Parameters
$eventName : string
Return values
array<string|int, mixed> —

extendableIsAccessible()

Checks if a property is accessible, property equivalent of `is_callable()`

protected extendableIsAccessible(mixed $class, string $propertyName) : bool
Parameters
$class : mixed
$propertyName : string
Return values
bool —

extensionExtractMethods()

Extracts the available methods from a behavior and adds it to the list of callable methods.

protected extensionExtractMethods(string $extensionName, object $extensionObject) : void
Parameters
$extensionName : string
$extensionObject : object
Return values
void —

fillableFromArray()

Get the fillable attributes of a given array.

protected fillableFromArray(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed> —

filterModelEventResults()

Filter the model event results.

protected filterModelEventResults(mixed $result) : mixed
Parameters
$result : mixed
Return values
mixed —

finishSave()

Perform any actions that are necessary after the model is saved.

protected finishSave(array<string|int, mixed> $options) : void
Parameters
$options : array<string|int, mixed>
Return values
void —

fireCustomModelEvent()

Fire a custom model event for the given event.

protected fireCustomModelEvent(string $event, string $method) : mixed|null
Parameters
$event : string
$method : string
Return values
mixed|null —

fireModelEvent()

Fire the given event for the model.

protected fireModelEvent(string $event[, bool $halt = true ]) : mixed
Parameters
$event : string
$halt : bool = true
Return values
mixed —

generatePassword()

Assigns this user with a random password.

protected generatePassword() : void
Return values
void —

getArrayableAppends()

Get all of the appendable values that are arrayable.

protected getArrayableAppends() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getArrayableAttributes()

Get an attribute array of all arrayable attributes.

protected getArrayableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getArrayableItems()

Get an attribute array of all arrayable values.

protected getArrayableItems(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>
Return values
array<string|int, mixed> —

getArrayableRelations()

Get an attribute array of all arrayable relations.

protected getArrayableRelations() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getArrayAttributeByKey()

Get an array attribute or return an empty array if it is not set.

protected getArrayAttributeByKey(string $key) : array<string|int, mixed>
Parameters
$key : string
Return values
array<string|int, mixed> —

getArrayAttributeWithValue()

Get an array attribute with the given key and value set.

protected getArrayAttributeWithValue(string $path, string $key, mixed $value) : $this
Parameters
$path : string
$key : string
$value : mixed
Return values
$this —

getAttributeFromArray()

Get an attribute from the $attributes array.

protected getAttributeFromArray(string $key) : mixed
Parameters
$key : string
Return values
mixed —

getCastType()

Get the type of cast for a model attribute.

protected getCastType(string $key) : string
Parameters
$key : string
Return values
string —

getDateFormat()

Get the format for database stored dates.

protected getDateFormat() : string
Return values
string —

getDeferrableRelationTypes()

Returns all possible relation types that can be deferred.

protected getDeferrableRelationTypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getDeferredBindingRecords()

Returns any outstanding binding records for this model.

protected getDeferredBindingRecords(mixed $sessionKey) : Collection
Parameters
$sessionKey : mixed
Return values
Collection —

getKeyForSaveQuery()

Get the primary key value for a save query.

protected getKeyForSaveQuery() : mixed
Return values
mixed —

getMorphs()

Get the polymorphic relationship columns.

protected getMorphs(string $name, string $type, string $id) : array<string|int, mixed>
Parameters
$name : string
$type : string
$id : string
Return values
array<string|int, mixed> —

getMutatorMethods()

Get all of the attribute mutator methods.

protected static getMutatorMethods(mixed $class) : array<string|int, mixed>
Parameters
$class : mixed
Return values
array<string|int, mixed> —

getRelationCaller()

Finds the calling function name from the stack trace.

protected getRelationCaller() : mixed
Return values
mixed —

getRelationDefaults()

Returns default relation arguments for a given type.

protected getRelationDefaults(string $type) : array<string|int, mixed>
Parameters
$type : string

Relation type

Return values
array<string|int, mixed> —

getRelationshipFromMethod()

Get a relationship value from a method.

protected getRelationshipFromMethod(string $method) : mixed
Parameters
$method : string
Tags
throws
LogicException
Return values
mixed —

getRelationValidationValue()

Attachments validate differently to their simple values.

protected getRelationValidationValue(mixed $relationName) : mixed
Parameters
$relationName : mixed
Return values
mixed —

getValidationAttributes()

Returns the model data used for validation.

protected getValidationAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —

guessBelongsToManyRelation()

Get the relationship name of the belongs to many.

protected guessBelongsToManyRelation() : string
Return values
string —

guessBelongsToRelation()

Guess the "belongs to" relationship name.

protected guessBelongsToRelation() : string
Return values
string —

handleRelation()

Looks for the relation and does the correct magic as Eloquent would require inside relation methods. For more information, read the documentation of the mentioned property.

protected handleRelation(string $relationName) : Relation
Parameters
$relationName : string

the relation key, camel-case version

Return values
Relation —

hasChanges()

Determine if the given attributes were changed.

protected hasChanges(array<string|int, mixed> $changes[, array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
$changes : array<string|int, mixed>
$attributes : array<string|int, mixed>|string|null = null
Return values
bool —

increment()

Increment a column's value by a given amount.

protected increment(string $column[, int $amount = 1 ][, array<string|int, mixed> $extra = [] ]) : int
Parameters
$column : string
$amount : int = 1
$extra : array<string|int, mixed> = []
Return values
int —

incrementOrDecrement()

Run the increment or decrement method on the model.

protected incrementOrDecrement(string $column, int $amount, array<string|int, mixed> $extra, string $method) : int
Parameters
$column : string
$amount : int
$extra : array<string|int, mixed>
$method : string
Return values
int —

incrementOrDecrementAttributeValue()

Increment the underlying attribute value and sync with original.

protected incrementOrDecrementAttributeValue(string $column, int $amount, array<string|int, mixed> $extra, string $method) : void
Parameters
$column : string
$amount : int
$extra : array<string|int, mixed>
$method : string
Return values
void —

insertAndSetId()

Insert the given attributes and set the ID on the model.

protected insertAndSetId(Builder $query, array<string|int, mixed> $attributes) : void
Parameters
$query : Builder
$attributes : array<string|int, mixed>
Return values
void —

isDateAttribute()

Determine if the given attribute is a date or date castable.

protected isDateAttribute(string $key) : bool
Parameters
$key : string
Return values
bool —

isDateCastable()

Determine whether a value is Date / DateTime castable for inbound manipulation.

protected isDateCastable(string $key) : bool
Parameters
$key : string
Return values
bool —

isGuardableColumn()

Determine if the given column is a valid, guardable column.

protected isGuardableColumn(string $key) : bool
Parameters
$key : string
Return values
bool —

isJsonCastable()

Determine whether a value is JSON castable for inbound manipulation.

protected isJsonCastable(string $key) : bool
Parameters
$key : string
Return values
bool —

isStandardDateFormat()

Determine if the given value is a standard date format.

protected isStandardDateFormat(string $value) : bool
Parameters
$value : string
Return values
bool —

makeValidator()

Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel. Optional connection string to make the validator use a different database connection than the default connection.

protected static makeValidator(mixed $data, mixed $rules, mixed $customMessages, mixed $attributeNames[, mixed $connection = null ]) : Validator
Parameters
$data : mixed
$rules : mixed
$customMessages : mixed
$attributeNames : mixed
$connection : mixed = null
Return values
Validator —

morphEagerTo()

Define a polymorphic, inverse one-to-one or many relationship.

protected morphEagerTo(string $name, string $type, string $id) : MorphTo
Parameters
$name : string
$type : string
$id : string
Return values
MorphTo —

morphInstanceTo()

Define a polymorphic, inverse one-to-one or many relationship.

protected morphInstanceTo(string $target, string $name, string $type, string $id) : MorphTo
Parameters
$target : string
$name : string
$type : string
$id : string
Return values
MorphTo —

mutateAttribute()

Get the value of an attribute using its mutator.

protected mutateAttribute(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed
Return values
mixed —

mutateAttributeForArray()

Get the value of an attribute using its mutator for array conversion.

protected mutateAttributeForArray(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed
Return values
mixed —

newBaseQueryBuilder()

Get a new query builder instance for the connection.

protected newBaseQueryBuilder() : Builder
Return values
Builder —

newBelongsTo()

Instantiate a new BelongsTo relationship.

protected newBelongsTo(Builder $query, Model $child, string $foreignKey, string $ownerKey, string $relation) : BelongsTo
Parameters
$query : Builder
$child : Model
$foreignKey : string
$ownerKey : string
$relation : string
Return values
BelongsTo —

newBelongsToMany()

Instantiate a new BelongsToMany relationship.

protected newBelongsToMany(Builder $query, Model $parent, string $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey[, string $relationName = null ]) : BelongsToMany
Parameters
$query : Builder
$parent : Model
$table : string
$foreignPivotKey : string
$relatedPivotKey : string
$parentKey : string
$relatedKey : string
$relationName : string = null
Return values
BelongsToMany —

newHasMany()

Instantiate a new HasMany relationship.

protected newHasMany(Builder $query, Model $parent, string $foreignKey, string $localKey) : HasMany
Parameters
$query : Builder
$parent : Model
$foreignKey : string
$localKey : string
Return values
HasMany —

newHasManyThrough()

Instantiate a new HasManyThrough relationship.

protected newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, string $firstKey, string $secondKey, string $localKey, string $secondLocalKey) : HasManyThrough
Parameters
$query : Builder
$farParent : Model
$throughParent : Model
$firstKey : string
$secondKey : string
$localKey : string
$secondLocalKey : string
Return values
HasManyThrough —

newHasOne()

Instantiate a new HasOne relationship.

protected newHasOne(Builder $query, Model $parent, string $foreignKey, string $localKey) : HasOne
Parameters
$query : Builder
$parent : Model
$foreignKey : string
$localKey : string
Return values
HasOne —

newMorphMany()

Instantiate a new MorphMany relationship.

protected newMorphMany(Builder $query, Model $parent, string $type, string $id, string $localKey) : MorphMany
Parameters
$query : Builder
$parent : Model
$type : string
$id : string
$localKey : string
Return values
MorphMany —

newMorphOne()

Instantiate a new MorphOne relationship.

protected newMorphOne(Builder $query, Model $parent, string $type, string $id, string $localKey) : MorphOne
Parameters
$query : Builder
$parent : Model
$type : string
$id : string
$localKey : string
Return values
MorphOne —

newMorphTo()

Instantiate a new MorphTo relationship.

protected newMorphTo(Builder $query, Model $parent, string $foreignKey, string $ownerKey, string $type, string $relation) : MorphTo
Parameters
$query : Builder
$parent : Model
$foreignKey : string
$ownerKey : string
$type : string
$relation : string
Return values
MorphTo —

newMorphToMany()

Instantiate a new HasManyThrough relationship.

protected newMorphToMany(Builder $query, Model $parent, string $name, string $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey[, string $relationName = null ][, bool $inverse = false ]) : MorphToMany
Parameters
$query : Builder
$parent : Model
$name : string
$table : string
$foreignPivotKey : string
$relatedPivotKey : string
$parentKey : string
$relatedKey : string
$relationName : string = null
$inverse : bool = false
Return values
MorphToMany —

newRelatedInstance()

Create a new model instance for a related model.

protected newRelatedInstance(string $class) : mixed
Parameters
$class : string
Return values
mixed —

originalIsEquivalent()

Determine if the new and old values for a given key are equivalent.

protected originalIsEquivalent(string $key, mixed $current) : bool
Parameters
$key : string
$current : mixed
Return values
bool —

performDeleteOnModel()

Perform the actual delete query on this model instance.

protected performDeleteOnModel() : void
Return values
void —

performDeleteOnRelations()

Locates relations with delete flag and cascades the delete event.

protected performDeleteOnRelations() : void
Return values
void —

performInsert()

Perform a model insert operation.

protected performInsert(Builder $query) : bool
Parameters
$query : Builder
Return values
bool —

performRestoreOnRelations()

Locates relations with softDelete flag and cascades the restore event.

protected performRestoreOnRelations() : void
Return values
void —

performSoftDeleteOnRelations()

Locates relations with softDelete flag and cascades the delete event.

protected performSoftDeleteOnRelations() : void
Return values
void —

performUpdate()

Perform a model update operation.

protected performUpdate(Builder $query) : bool
Parameters
$query : Builder
Return values
bool —

processRuleFieldNames()

Processes field names in a rule array.

protected processRuleFieldNames(array<string|int, mixed> $rules) : array<string|int, mixed>

Converts any field names using array notation (ie. field[child]) into dot notation (ie. field.child)

Parameters
$rules : array<string|int, mixed>

Rules array

Return values
array<string|int, mixed> —

processValidationRules()

Process rules

protected processValidationRules(mixed $rules) : mixed
Parameters
$rules : mixed
Return values
mixed —

processValidationUniqueRule()

Rebuilds the unique validation rule to force for the existing ID

protected processValidationUniqueRule(string $definition, string $fieldName) : string
Parameters
$definition : string
$fieldName : string
Return values
string —

registerModelEvent()

Register a model event with the dispatcher.

protected static registerModelEvent(string $event, Closure|string $callback) : void
Parameters
$event : string
$callback : Closure|string
Return values
void —

removeTableFromKey()

Remove the table name from a given key.

protected removeTableFromKey(string $key) : string
Parameters
$key : string
Return values
string —

runSoftDelete()

Perform the actual delete query on this model instance.

protected runSoftDelete() : void
Return values
void —

saveInternal()

Save the model to the database. Is used by {@link save()} and {@link forceSave()}.

protected saveInternal([array<string|int, mixed> $options = [] ]) : bool
Parameters
$options : array<string|int, mixed> = []
Return values
bool —

sendInvitation()

Sends an invitation to the user using template "rainlab.user::mail.invite".

protected sendInvitation() : void
Return values
void —

serializeDate()

Prepare a date for array / JSON serialization.

protected serializeDate(DateTimeInterface $date) : string
Parameters
$date : DateTimeInterface
Return values
string —

setKeysForSaveQuery()

Set the keys for a save update query.

protected setKeysForSaveQuery(Builder $query) : Builder
Parameters
$query : Builder
Return values
Builder —

setRelationValue()

Sets a relation value directly from its attribute.

protected setRelationValue(mixed $relationName, mixed $value) : mixed
Parameters
$relationName : mixed
$value : mixed
Return values
mixed —

updateTimestamps()

Update the creation and update timestamps.

protected updateTimestamps() : void
Return values
void —

validateRelationArgs()

Validate relation supplied arguments.

protected validateRelationArgs(mixed $relationName, mixed $optional[, mixed $required = [] ]) : mixed
Parameters
$relationName : mixed
$optional : mixed
$required : mixed = []
Return values
mixed —

Search results