User
User model
class Winter\Storm\Auth\Models\User
extends Winter\Storm\Database\Model
implements
Illuminate\Contracts\Auth\Authenticatable,
Winter\Storm\Database\ModelInterface
Extends
Class | Description |
---|---|
Model
|
Active Record base class. |
Traits
Trait | Description |
---|---|
DeferredBinding
|
|
Emitter
|
Adds event related features to any class. |
ExtendableTrait
|
This extension trait is used when access to the underlying base class is not available, such as classes that belong to the foundation framework (Laravel). It is currently used by the Controller and Model classes. |
GuardsAttributes
|
|
HasRelationships
|
|
Hashable
|
|
HidesAttributes
|
Hides and shows attributes for serialization. |
Purgeable
|
|
Validation
|
Properties
public
$attributeNames
:
array
= []
The array of custom attribute names.
public
$belongsTo
:
mixed
= {"role":{}}
public
$belongsToMany
:
array
= {"groups":{"0":{},"table":"users_groups"}}
Relations
public
$customMessages
:
array
= []
The array of custom error messages.
public
static
$loginAttribute
:
string
= "email"
The login attribute.
public
$rules
:
array
= {"email":"required|between:3,255|email|unique:users","password":"required:create|min:4|confirmed","password_confirmation":"required_with:password|min:4"}
Validation rules
protected
$allowedPermissionsValues
:
array
= [-1,0,1]
Allowed permissions values.
Possible options: -1 => Deny (adds to array, but denies regardless of user's group). 0 => Remove. 1 => Add.
protected
$dates
:
array
= ["activated_at","last_login"]
The attributes that should be mutated to dates.
protected
$guarded
:
string[]
|
bool
= ["is_superuser","reset_password_code","activation_code","persist_code","role_id"]
The attributes that aren't mass assignable.
protected
$hashable
:
array
= ["password","persist_code"]
List of attribute names which should be hashed using the Bcrypt hashing algorithm.
protected
$hidden
:
array<int,string>
= ["password","reset_password_code","activation_code","persist_code"]
The attributes that should be hidden for arrays.
protected
$jsonable
:
array
= ["permissions"]
List of attribute names which are json encoded and decoded from the database.
protected $mergedPermissions : array
The user merged permissions.
protected
$purgeable
:
array
= ["password_confirmation"]
List of attribute names which should not be saved to the database.
protected
$rememberTokenName
:
string
= "persist_code"
The column name of the "remember me" token.
protected
$table
:
string
= "users"
The table associated with the model.
inherited
public
$attachMany
:
mixed
= []
protected $attachMany = [ 'pictures' => ['Winter\Storm\Database\Attach\File', 'name'=> 'imageable'] ];
inherited
public
$attachOne
:
mixed
= []
protected $attachOne = [ 'picture' => ['Winter\Storm\Database\Attach\File', 'public' => false] ];
inherited
public
$attributes
:
array
= []
Make the model's attributes public so behaviors can modify them.
inherited
public
$duplicateCache
:
bool
= true
Indicates if duplicate queries from this model should be cached in memory.
inherited
public
$hasMany
:
array
= []
Cleaner declaration of relationships.
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' ]; }
inherited
public
$hasManyThrough
:
mixed
= []
protected $hasManyThrough = [ 'posts' => ['Posts', 'through' => 'User'] ];
inherited
public
$hasOne
:
mixed
= []
protected $hasOne = [ 'owner' => ['User', 'key' => 'user_id'] ];
inherited
public
$hasOneThrough
:
mixed
= []
protected $hasOneThrough = [ 'post' => ['Posts', 'through' => 'User'] ];
inherited
public
$implement
:
string
|
array
|
null
= null
Extensions implemented by this class.
inherited
public
$morphMany
:
mixed
= []
protected $morphMany = [ 'log' => ['History', 'name' => 'user'] ];
inherited
public
$morphOne
:
mixed
= []
protected $morphOne = [ 'log' => ['History', 'name' => 'user'] ];
inherited
public
$morphTo
:
mixed
= []
protected $morphTo = [ 'pictures' => [] ];
inherited
public
$morphToMany
:
mixed
= []
protected $morphToMany = [ 'tag' => ['Tag', 'table' => 'tagables', 'name' => 'tagable'] ];
inherited
public
$morphedByMany
:
mixed
= []
inherited public $sessionKey : string
A unique session key used for deferred binding.
inherited
public
$trimStringAttributes
:
bool
= true
Indicates if all string model attributes will be trimmed prior to saving.
inherited
protected
$emitterEventCollection
:
array
= []
Collection of registered events.
inherited
protected
$emitterEventSorted
:
array
= []
Sorted collection of events.
inherited
protected
$emitterSingleEventCollection
:
array
= []
Collection of registered events to be fired once only.
inherited
protected
static
$eventsBooted
:
array
= []
The array of models booted events.
inherited
protected
static
$extendableCallbacks
:
array
= []
Used to extend the constructor of an extendable class. Eg:
Class::extend(function($obj) { })
inherited
protected
static
$extendableClassLoader
:
ClassLoader
|
null
= null
Class loader instance.
inherited
protected
static
$extendableStaticMethods
:
array
= []
Collection of static methods used by behaviors.
inherited
protected
$extensionData
:
array
= {"extensions":[],"methods":[],"dynamicMethods":[],"dynamicProperties":[]}
Class reflection information, including behaviors.
inherited
protected
$originalHashableValues
:
array
= []
List of original attribute values before they were hashed.
inherited
protected
$originalPurgeableValues
:
array
= []
List of original attribute values before they were purged.
inherited
protected
static
$relationTypes
:
array
= ["hasOne","hasMany","belongsTo","belongsToMany","morphTo","morphOne","morphMany","morphToMany","morphedByMany","attachOne","attachMany","hasOneThrough","hasManyThrough"]
Excepted relationship types, used to cycle and verify relationships.
inherited
protected
$validationDefaultAttrNames
:
array
= []
Default custom attribute names.
inherited protected $validationErrors : Illuminate\Support\MessageBag
The message bag instance containing validation error messages
Methods
public addGroup (Group $group) : bool
Adds the user to the given group.
Property | Type | Description |
---|---|---|
$group | Group |
Group
|
public afterLogin ()
public attemptActivation (string $activationCode) : bool
Attempts to activate the given user by checking the activate code. If the user is activated already, an Exception is thrown.
Property | Type | Description |
---|---|---|
$activationCode | string |
string
|
public attemptResetPassword (string $resetCode, string $newPassword) : bool
Attempts to reset a user's password by matching the reset code generated with the user's.
Property | Type | Description |
---|---|---|
$resetCode | string |
string
|
$newPassword | string |
string
|
public beforeLogin ()
public
canBeImpersonated (boolean $impersonator = false
)
: bool
Check if this user can be impersonated by the provided impersonator
Property | Type | Description |
---|---|---|
$impersonator | boolean |
boolean
The user attempting to impersonate this user, false when not available |
public checkPassword (string $password) : bool
Checks the password passed matches the user's password.
Property | Type | Description |
---|---|---|
$password | string |
string
|
public checkPersistCode (string $persistCode) : bool
Checks the given persist code.
Property | Type | Description |
---|---|---|
$persistCode | string |
string
|
public checkResetPasswordCode (string $resetCode) : bool
Checks if the provided user reset password code is valid without actually resetting the password.
Property | Type | Description |
---|---|---|
$resetCode | string |
string
|
public clearResetPassword () : void
Wipes out the data associated with resetting a password.
public getActivationCode () : string
Get an activation code for the given user.
public getAuthIdentifier () : mixed
Get the unique identifier for the user.
public getAuthIdentifierName () : string
Get the name of the unique identifier for the user.
public getAuthPassword () : string
Get the password for the user.
public getGroups () : array
Returns an array of groups which the given user belongs to.
public getIsActivatedAttribute (mixed $activated) : bool
Get mutator for giving the activated property.
Property | Type | Description |
---|---|---|
$activated | mixed |
mixed
|
public getLogin () : mixed
Returns the user's login.
public getLoginName () : string
Returns the name for the user's login.
public getMergedPermissions () : array
Returns an array of merged permissions based on the user's individual permissions and their group permissions
public getPersistCode () : string
Gets a code for when the user is persisted to a cookie or session which identifies the user.
public
getRandomString (integer $length = 42
)
: string
Generate a random string
Property | Type | Description |
---|---|---|
$length | integer |
integer
|
public getRememberToken () : string
Get the token value for the "remember me" session.
public getRememberTokenName () : string
Get the column name for the "remember me" token.
public getReminderEmail () : string
Get the e-mail address where password reminders are sent.
public getResetPasswordCode () : string
Get a reset password code for the given user.
public getRole () : Winter\Storm\Auth\Models\Role | null
public
hasAccess (string | array $permissions, boolean $all = true
)
: bool
See if a user has access to the passed permission(s).
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.
Property | Type | Description |
---|---|---|
$permissions | string | array |
string | array
|
$all | boolean |
boolean
|
public hasAnyAccess (array $permissions) : bool
Returns if the user has access to any of the given permissions.
Property | Type | Description |
---|---|---|
$permissions | array |
array
|
public
hasPermission (string | array $permissions, boolean $all = true
)
: bool
See if a user has access to the passed permission(s).
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.
Property | Type | Description |
---|---|---|
$permissions | string | array |
string | array
|
$all | boolean |
boolean
|
public inGroup (Group $group) : bool
See if the user is in the given group.
Property | Type | Description |
---|---|---|
$group | Group |
Group
|
public isSuperUser () : bool
Checks if the user is a super user - has access to everything regardless of permissions.
public removeGroup (Group $group) : bool
Removes the user from the given group.
Property | Type | Description |
---|---|---|
$group | Group |
Group
|
public setPasswordAttribute ($value)
Protects the password from being reset to null.
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
public setPermissionsAttribute (string $permissions) : void
Validate any set permissions.
Property | Type | Description |
---|---|---|
$permissions | string |
string
|
public setRememberToken (string | null $value) : void
Set the token value for the "remember me" session.
Property | Type | Description |
---|---|---|
$value | string | null |
string | null
|
inherited public __call ($name, $params)
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$params | mixed |
mixed
|
inherited public static __callStatic ($name, $params)
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$params | mixed |
mixed
|
inherited
public
__construct (array $attributes = []
)
Constructor
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
inherited public __get ($name)
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
inherited public __isset (string $key) : bool
Determine if an attribute or relation exists on the model.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited public __set ($name, $value)
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$value | mixed |
mixed
|
inherited public addAttachManyRelation (string $name, array $config) : void
Dynamically add an AttachMany relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addAttachOneRelation (string $name, array $config) : void
Dynamically add an AttachOne relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addBelongsToManyRelation (string $name, array $config) : void
Dynamically add a BelongsToMany relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addBelongsToRelation (string $name, array $config) : void
Dynamically add a BelongsTo relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addCasts (array $attributes) : void
Add attribute casts for the model.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
inherited public addDateAttribute (string $attribute) : void
Adds a datetime attribute to convert to an instance of Carbon/DateTime object.
Property | Type | Description |
---|---|---|
$attribute | string |
string
|
inherited
public
addDynamicMethod (string $dynamicName, callable $method, string $extension = null
)
Programmatically adds a method to the extendable class
Property | Type | Description |
---|---|---|
$dynamicName | string |
string
|
$method | callable |
callable
|
$extension | string |
string
|
inherited
public
addDynamicProperty (string $dynamicName, mixed $value = null
)
: void
Programmatically adds a property to the extendable class
Property | Type | Description |
---|---|---|
$dynamicName | string |
string
The name of the property to add |
$value | mixed |
mixed
The value of the property |
inherited
public
addFillable (array | string | null $attributes = null
)
: void
Add fillable attributes for the model.
Property | Type | Description |
---|---|---|
$attributes | array | string | null |
array | string | null
|
inherited public addHasManyRelation (string $name, array $config) : void
Dynamically add a HasMany relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addHasManyThroughRelation (string $name, array $config) : void
Dynamically add a(n) HasManyThrough relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addHasOneRelation (string $name, array $config) : void
Dynamically add a HasOne relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addHasOneThroughRelation (string $name, array $config) : void
Dynamically add a(n) HasOneThrough relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited
public
addHashable (array | string | null $attributes = null
)
: $this
Adds an attribute to the hashable attributes list
Property | Type | Description |
---|---|---|
$attributes | array | string | null |
array | string | null
|
inherited public addHashableAttribute ($attribute)
Property | Type | Description |
---|---|---|
$attribute | mixed |
mixed
|
inherited
public
addHidden (array | string | null $attributes = null
)
: void
Add hidden attributes for the model.
This restores the addHidden
method that was removed from Laravel 7 onwards. It is however recommended to use
the makeHidden
method going forward.
Property | Type | Description |
---|---|---|
$attributes | array | string | null |
array | string | null
|
inherited
public
addJsonable (array | string | null $attributes = null
)
: void
Add jsonable attributes for the model.
Property | Type | Description |
---|---|---|
$attributes | array | string | null |
array | string | null
|
inherited public addMorphManyRelation (string $name, array $config) : void
Dynamically add a MorphMany relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addMorphOneRelation (string $name, array $config) : void
Dynamically add a MorphOne relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addMorphToManyRelation (string $name, array $config) : void
Dynamically add a MorphToMany relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addMorphToRelation (string $name, array $config) : void
Dynamically add a MorphTo relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited public addMorphedByManyRelation (string $name, array $config) : void
Dynamically add a MorphedByMany relationship
Property | Type | Description |
---|---|---|
$name | string |
string
|
$config | array |
array
|
inherited
public
addPurgeable (array | string | null $attributes = null
)
: $this
Adds an attribute to the purgeable attributes list
Property | Type | Description |
---|---|---|
$attributes | array | string | null |
array | string | null
|
inherited
public
addVisible (array | string | null $attributes = null
)
: void
Add visible attributes for the model.
This restores the addVisible
method that was removed from Laravel 7 onwards. It is however recommended to use
the makeVisible
method going forward.
Property | Type | Description |
---|---|---|
$attributes | array | string | null |
array | string | null
|
inherited
public
alwaysPush (array $options = []
, string | null $sessionKey = null
)
: bool
Pushes the first level of relations even if the parent model has no changes.
Property | Type | Description |
---|---|---|
$options | array |
array
|
$sessionKey | string | null |
string | null
|
inherited public asExtension (string $shortName) : mixed
Short hand for getClassExtension()
method, except takes the short
extension name, example:
$this->asExtension('FormController')
Property | Type | Description |
---|---|---|
$shortName | string |
string
|
inherited
public
attachMany ($related, $isPublic = null
, $localKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\AttachMany
Define an attachment one-to-many relationship.
This code is a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$isPublic | mixed |
mixed
|
$localKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited
public
attachOne ($related, boolean $isPublic = true
, $localKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\AttachOne
Define an attachment one-to-one relationship.
This code is a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$isPublic | boolean |
boolean
|
$localKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited public attributesToArray () : array
Convert the model's attributes to an array.
inherited
public
belongsTo ($related, $foreignKey = null
, $parentKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\BelongsTo
Define an inverse one-to-one or many relationship.
Overridden from {@link Eloquent\Model} to allow the usage of the intermediary methods to handle the {@link $relationsData} array.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$foreignKey | mixed |
mixed
|
$parentKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited
public
belongsToMany ($related, $table = null
, $primaryKey = null
, $foreignKey = null
, $parentKey = null
, $relatedKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\BelongsToMany
Define a many-to-many relationship.
This code is almost a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$table | mixed |
mixed
|
$primaryKey | mixed |
mixed
|
$foreignKey | mixed |
mixed
|
$parentKey | mixed |
mixed
|
$relatedKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited
public
bindDeferred (string $relation, Illuminate\Database\Eloquent\Model $record, string $sessionKey, array $pivotData = []
)
: Winter\Storm\Database\Models\DeferredBinding
Bind a deferred relationship to the supplied record.
Property | Type | Description |
---|---|---|
$relation | string |
string
|
$record | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | string |
string
|
$pivotData | array |
array
|
inherited
public
bindEvent (string | Closure | QueuedClosure $event, mixed $callback = null
, integer $priority)
: self
Create a new event binding.
Property | Type | Description |
---|---|---|
$event | string | Closure | QueuedClosure |
string | Closure | QueuedClosure
|
$callback | mixed |
mixed
when the third parameter is omitted and a Closure or QueuedClosure is provided this parameter is used as an integer this is used as priority variable |
$priority | integer |
integer
|
inherited
public
bindEventOnce (string | Closure | QueuedClosure $event, QueuedClosure | Closure | null $callback = null
)
: self
Create a new event binding that fires once only
Property | Type | Description |
---|---|---|
$event | string | Closure | QueuedClosure |
string | Closure | QueuedClosure
|
$callback | QueuedClosure | Closure | null |
QueuedClosure | Closure | null
When a Closure or QueuedClosure is provided as the first parameter this parameter can be omitted |
inherited public static bootHashable () : void
Boot the hashable trait for a model.
inherited public static bootPurgeable () : void
Boot the purgeable trait for a model.
inherited public static bootValidation () : void
Boot the validation trait for this model.
inherited public cancelDeferred (string $sessionKey) : void
Cancel all deferred bindings to this model.
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
inherited public checkHashValue (string $key, string $value) : bool
Checks if the supplied plain value matches the stored hash value.
Property | Type | Description |
---|---|---|
$key | string |
string
Attribute to check |
$value | string |
string
Value to check |
inherited public static clearExtendedClasses () : void
Clear the list of extended classes so they will be re-extended.
inherited public commitDeferred (string $sessionKey) : void
Commit all deferred bindings to this model.
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
inherited
public
static
create (array $attributes = []
, string $sessionKey = null
)
: Illuminate\Database\Eloquent\Model | static
Save a new model and return the instance.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
$sessionKey | string |
string
|
inherited public errors () : Illuminate\Support\MessageBag
Get validation error message collection for the Model
inherited public extendClassWith (string $extensionName) : void
Dynamically extend a class with a specified behavior
Property | Type | Description |
---|---|---|
$extensionName | string |
string
|
inherited
public
extendableCall (string $name, array $params = null
)
: mixed
Magic method for __call()
.
Callback priority is as follows:
- "Dynamic Methods" added locally to the object via addDynamicMethod($name, $callable)
- Methods available on Behaviors that have been implemented by the object
- Pass it to the parent's __call() method if it defines one
Property | Type | Description |
---|---|---|
$name | string |
string
|
$params | array |
array
|
inherited
public
static
extendableCallStatic (string $name, array $params = null
)
: mixed
Magic method for __callStatic()
Property | Type | Description |
---|---|---|
$name | string |
string
|
$params | array |
array
|
inherited public extendableConstruct ()
This method should be called as part of the constructor.
inherited
public
static
extendableExtendCallback (callable $callback, boolean $scoped = false
, $outerScope = null
)
: void
Helper method for ::extend()
static method.
Property | Type | Description |
---|---|---|
$callback | callable |
callable
|
$scoped | boolean |
boolean
|
$outerScope | mixed |
mixed
|
inherited public extendableGet (string $name) : mixed | null
Magic method for __get()
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited public extendableSet (string $name, mixed $value) : void
Magic method for __set()
Property | Type | Description |
---|---|---|
$name | string |
string
|
$value | mixed |
mixed
|
inherited public static fetched (Closure | string $callback) : void
Create a new native event for handling afterFetch().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited public static fetching (Closure | string $callback) : void
Create a new native event for handling beforeFetch().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited
public
fireEvent (string $event, array $params = []
, boolean $halt = false
)
: array | mixed | null
Fire an event and call the listeners.
Property | Type | Description |
---|---|---|
$event | string |
string
Event name |
$params | array |
array
Event parameters |
$halt | boolean |
boolean
Halt after first non-null result |
If halted, the first non-null result. If not halted, an array of event results. Returns null if no listeners returned a result.
inherited public static flushDuplicateCache () : void
Flush the memory cache.
inherited public static flushEventListeners () : void
Remove all of the event listeners for the model Also flush registry of models that had events booted Allows painless unit testing.
inherited
public
forceSave ($options = null
, $sessionKey = null
)
: bool
Force save the model even if validation fails.
Property | Type | Description |
---|---|---|
$options | mixed |
mixed
|
$sessionKey | mixed |
mixed
|
inherited public freshTimestamp () : Illuminate\Support\Carbon
Get a fresh timestamp for the model.
inherited
public
fromDateTime (DateTime | int | null $value = null
)
: string | null
Convert a DateTime to a storable string.
Property | Type | Description |
---|---|---|
$value | DateTime | int | null |
DateTime | int | null
|
inherited public getAttribute (string $key) : mixed
Get an attribute from the model.
Overrides {@link Eloquent} to support loading from property-defined relations.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited public getAttributeValue (string $key) : mixed
Get a plain attribute (not a relationship).
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited public getClassExtension (string $name) : mixed
Returns a behavior object from an extendable class, example:
$this->getClassExtension('Backend.Behaviors.FormController')
Property | Type | Description |
---|---|---|
$name | string |
string
Fully qualified behavior name |
inherited public getClassMethods () : array
Get a list of class methods, extension equivalent of get_class_methods()
inherited public getDynamicProperties () : array
Returns all dynamic properties and their values
['property' => 'value']
inherited public getHashableAttributes () : array
Returns a collection of fields that will be hashed.
inherited public getJsonable () : array
Get the jsonable attributes name
inherited public getObservableEvents () : array
Get the observable event names.
inherited public getOriginalHashValue ($attribute) : mixed
Returns the original values of any hashed attributes.
Property | Type | Description |
---|---|---|
$attribute | mixed |
mixed
|
inherited public getOriginalHashValues () : array
Returns the original values of any hashed attributes.
inherited public getOriginalPurgeValue ($attribute)
Returns the original values of any purged attributes.
Property | Type | Description |
---|---|---|
$attribute | mixed |
mixed
|
inherited public getOriginalPurgeValues ()
Returns the original values of any purged attributes.
inherited public getPurgeableAttributes ()
Returns a collection of fields that will be hashed.
inherited public getRelationDefinition (string $name) : array | null
Returns relationship details from a supplied name.
Property | Type | Description |
---|---|---|
$name | string |
string
Relation name |
inherited public getRelationDefinitions () : array
Returns relationship details for all relations defined on this model.
inherited public getRelationType (string $name) : string | null
Returns a relationship type based on a supplied name.
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited public getRelationTypeDefinition (string $type, string $name) : string | null
Returns the given relation definition.
Property | Type | Description |
---|---|---|
$type | string |
string
Relation type |
$name | string |
string
Relation name |
inherited public getRelationTypeDefinitions (string $type) : array | string | null
Returns all defined relations of given type.
Property | Type | Description |
---|---|---|
$type | string |
string
Relation type |
inherited public getRelationValue ($relationName)
Returns a relation key value(s), not as an object.
Property | Type | Description |
---|---|---|
$relationName | mixed |
mixed
|
inherited public hasAttribute (string $key) : bool
Determine if the given attribute will be processed by getAttributeValue().
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited public static hasDatabaseTable () : bool
Static helper for isDatabaseReady()
inherited public hasGetMutator (string $key) : bool
Determine if a get mutator exists for an attribute.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited
public
hasMany ($related, $primaryKey = null
, $localKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\HasMany
Define a one-to-many relationship.
This code is a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$primaryKey | mixed |
mixed
|
$localKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited
public
hasManyThrough ($related, $through, $primaryKey = null
, $throughKey = null
, $localKey = null
, $secondLocalKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\HasManyThrough
Define a has-many-through relationship.
This code is a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$through | mixed |
mixed
|
$primaryKey | mixed |
mixed
|
$throughKey | mixed |
mixed
|
$localKey | mixed |
mixed
|
$secondLocalKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited
public
hasOne ($related, $primaryKey = null
, $localKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\HasOne
Define a one-to-one relationship.
This code is a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$primaryKey | mixed |
mixed
|
$localKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited
public
hasOneThrough ($related, $through, $primaryKey = null
, $throughKey = null
, $localKey = null
, $secondLocalKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\HasOneThrough
Define a has-one-through relationship.
This code is a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$through | mixed |
mixed
|
$primaryKey | mixed |
mixed
|
$throughKey | mixed |
mixed
|
$localKey | mixed |
mixed
|
$secondLocalKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited public hasRelation (string $name) : bool
Checks if model has a relationship by supplied name.
Property | Type | Description |
---|---|---|
$name | string |
string
Relation name |
inherited public hasSetMutator (string $key) : bool
Determine if a set mutator exists for an attribute.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited
public
isAttributeRequired (string $attribute, boolean $checkDependencies = true
)
: bool
Determines if an attribute is required based on the validation rules.
Property | Type | Description |
---|---|---|
$attribute | string |
string
|
$checkDependencies | boolean |
boolean
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 |
inherited public isClassExtendedWith (string $name) : bool
Check if extendable class is extended with a behavior object
Property | Type | Description |
---|---|---|
$name | string |
string
Fully qualified behavior name |
inherited public isDatabaseReady () : bool
Check if the model's database connection is ready
inherited public isDeferrable (string $relationName) : bool
Returns true if a relation exists and can be deferred.
Property | Type | Description |
---|---|---|
$relationName | string |
string
|
inherited public isGuarded (string $key) : bool
Determine if the given key is guarded.
This is an override of https://github.com/laravel/framework/commit/897d107775737a958dbd0b2f3ea37877c7526371
and allows fields that don't exist in the database to be filled if they aren't specified as "guarded", under
the pretense that they are handled in a special manner - ie. in the beforeSave
event.
Property | Type | Description |
---|---|---|
$key | string |
string
|
inherited public isJsonable ($key) : bool
Checks if an attribute is jsonable or not.
Property | Type | Description |
---|---|---|
$key | mixed |
mixed
|
inherited public isRelationPushable (string $name) : bool
Determines whether the specified relation should be saved when push() is called instead of save() on the model. Default: true.
Property | Type | Description |
---|---|---|
$name | string |
string
Relation name |
inherited public jsonable (array $jsonable) : $this
Set the jsonable attributes for the model.
Property | Type | Description |
---|---|---|
$jsonable | array |
array
|
inherited
public
static
make (array $attributes = []
)
: Illuminate\Database\Eloquent\Model | static
Create a new model and return the instance.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
inherited public makeHashValue (string $key, string $value) : string
Hashes an attribute value and saves it in the original locker.
Property | Type | Description |
---|---|---|
$key | string |
string
Attribute |
$value | string |
string
Value to hash |
Hashed value
inherited public makeRelation (string $name) : Winter\Storm\Database\Model | null
Returns a new instance of a related model
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited public methodExists (string $name) : bool
Checks if a method exists, extension equivalent of method_exists()
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited
public
morphMany ($related, $name, $type = null
, $id = null
, $localKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\MorphMany
Define a polymorphic one-to-many relationship.
This code is a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$name | mixed |
mixed
|
$type | mixed |
mixed
|
$id | mixed |
mixed
|
$localKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited
public
morphOne ($related, $name, $type = null
, $id = null
, $localKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\MorphOne
Define a polymorphic one-to-one relationship.
This code is a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$name | mixed |
mixed
|
$type | mixed |
mixed
|
$id | mixed |
mixed
|
$localKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited
public
morphTo ($name = null
, $type = null
, $id = null
, $ownerKey = null
)
: Winter\Storm\Database\Relations\MorphTo
Define an polymorphic, inverse one-to-one or many relationship.
Overridden from {@link Eloquent\Model} to allow the usage of the intermediary methods to handle the relation.
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$type | mixed |
mixed
|
$id | mixed |
mixed
|
$ownerKey | mixed |
mixed
|
inherited
public
morphToMany ($related, $name, $table = null
, $primaryKey = null
, $foreignKey = null
, $parentKey = null
, $relatedKey = null
, boolean $inverse = false
, $relationName = null
)
: Winter\Storm\Database\Relations\MorphToMany
Define a polymorphic many-to-many relationship.
This code is almost a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$name | mixed |
mixed
|
$table | mixed |
mixed
|
$primaryKey | mixed |
mixed
|
$foreignKey | mixed |
mixed
|
$parentKey | mixed |
mixed
|
$relatedKey | mixed |
mixed
|
$inverse | boolean |
boolean
|
$relationName | mixed |
mixed
|
inherited
public
morphedByMany ($related, $name, $table = null
, $primaryKey = null
, $foreignKey = null
, $parentKey = null
, $relatedKey = null
, $relationName = null
)
: Winter\Storm\Database\Relations\MorphToMany
Define a polymorphic many-to-many inverse relationship.
This code is almost a duplicate of Eloquent but uses a Storm relation class.
Property | Type | Description |
---|---|---|
$related | mixed |
mixed
|
$name | mixed |
mixed
|
$table | mixed |
mixed
|
$primaryKey | mixed |
mixed
|
$foreignKey | mixed |
mixed
|
$parentKey | mixed |
mixed
|
$relatedKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
inherited
public
newCollection (array $models = []
)
: Winter\Storm\Database\Collection
Create a new Model Collection instance.
Property | Type | Description |
---|---|---|
$models | array |
array
|
inherited public newEloquentBuilder (Winter\Storm\Database\QueryBuilder $query) : Winter\Storm\Database\Builder
Create a new Eloquent query builder for the model.
Property | Type | Description |
---|---|---|
$query | Winter\Storm\Database\QueryBuilder |
inherited
public
newFromBuilder (array $attributes = []
, $connection = null
)
: Illuminate\Database\Eloquent\Model | static
Create a new model instance that is existing.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
$connection | mixed |
mixed
|
inherited
public
newPivot (Illuminate\Database\Eloquent\Model $parent, array $attributes, string $table, bool $exists, string | null $using = null
)
: Winter\Storm\Database\Pivot
Create a generic pivot model instance.
Property | Type | Description |
---|---|---|
$parent | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$attributes | array |
array
|
$table | string |
string
|
$exists | bool |
bool
|
$using | string | null |
string | null
|
inherited public newRelationPivot (string $relationName, Winter\Storm\Database\Model $parent, array $attributes, string $table, bool $exists) : Winter\Storm\Database\Pivot | null
Create a pivot model instance specific to a relation.
Property | Type | Description |
---|---|---|
$relationName | string |
string
|
$parent | Winter\Storm\Database\Model | |
$attributes | array |
array
|
$table | string |
string
|
$exists | bool |
bool
|
inherited public offsetExists (mixed $offset) : bool
This a custom piece of logic specifically to satisfy Twig's desire to return a relation object instead of loading the related model.
Property | Type | Description |
---|---|---|
$offset | mixed |
mixed
|
inherited public propertyExists (string $name) : bool
Checks if a property exists, extension equivalent of property_exists()
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited
public
purgeAttributes (array | string $attributesToPurge = null
)
: array
Removes purged attributes from the dataset, used before saving.
Property | Type | Description |
---|---|---|
$attributesToPurge | array | string |
array | string
Attribute(s) to purge, if unspecified, $purgable property is used |
Current attribute set
inherited
public
push (array $options = []
, string | null $sessionKey = null
)
: bool
Save the model and all of its relationships.
Property | Type | Description |
---|---|---|
$options | array |
array
|
$sessionKey | string | null |
string | null
|
inherited public reload () : Illuminate\Database\Eloquent\Model | static
Reloads the model attributes from the database.
inherited
public
reloadRelations (string $relationName = null
)
: void
Reloads the model relationship cache.
Property | Type | Description |
---|---|---|
$relationName | string |
string
|
inherited public restorePurgedValues ()
Restores the original values of any purged attributes.
inherited
public
save (array $options = []
, string | null $sessionKey = null
)
: bool
Save the model to the database.
Property | Type | Description |
---|---|---|
$options | array |
array
|
$sessionKey | string | null |
string | null
|
inherited public setAttribute (string $key, mixed $value) : mixed | null
Set a given attribute on the model.
Property | Type | Description |
---|---|---|
$key | string |
string
|
$value | mixed |
mixed
|
inherited public setValidationAttributeName (string $attr, string $name) : void
Programatically sets the validation attribute names, will take lower priority
to model defined attribute names found in $attributeNames
.
Property | Type | Description |
---|---|---|
$attr | string |
string
|
$name | string |
string
|
inherited public setValidationAttributeNames (array $attributeNames) : void
Programatically sets multiple validation attribute names.
Property | Type | Description |
---|---|---|
$attributeNames | array |
array
|
inherited public unbindDeferred (string $relation, Illuminate\Database\Eloquent\Model $record, string $sessionKey) : Winter\Storm\Database\Models\DeferredBinding
Unbind a deferred relationship to the supplied record.
Property | Type | Description |
---|---|---|
$relation | string |
string
|
$record | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | string |
string
|
inherited
public
unbindEvent (string | array | object $event = null
)
: self
Destroys an event binding.
Property | Type | Description |
---|---|---|
$event | string | array | object |
string | array | object
Event to destroy |
inherited
public
validate ($rules = null
, $customMessages = null
, $attributeNames = null
)
: bool
Validate the model instance
Property | Type | Description |
---|---|---|
$rules | mixed |
mixed
|
$customMessages | mixed |
mixed
|
$attributeNames | mixed |
mixed
|
inherited public static validated (Closure | string $callback) : void
Create a new native event for handling afterValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited public static validating (Closure | string $callback) : void
Create a new native event for handling beforeValidate().
Property | Type | Description |
---|---|---|
$callback | Closure | string |
Closure | string
|
inherited protected addRelation (string $type, string $name, array $config) : void
Dynamically add the provided relationship configuration to the local properties
Property | Type | Description |
---|---|---|
$type | string |
string
|
$name | string |
string
|
$config | array |
array
|
inherited protected afterCreate ()
Handle the "created" model event
inherited protected afterDelete ()
Handle the "deleted" model event
inherited protected afterFetch ()
Handle the "fetched" model event
inherited protected afterSave ()
Handle the "saved" model event
inherited protected afterUpdate ()
Handle the "updated" model event
inherited protected asDateTime (mixed $value) : Carbon\Carbon
Return a timestamp as DateTime object.
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
inherited protected beforeCreate ()
Handle the "creating" model event
inherited protected beforeDelete ()
Handle the "deleting" model event
inherited protected beforeFetch ()
Handle the "fetching" model event
inherited protected beforeSave ()
Handle the "saving" model event
inherited protected beforeUpdate ()
Handle the "updating" model event
inherited protected bootNicerEvents ()
Bind some nicer events to this model, in the format of method overrides.
inherited protected commitDeferredAfter (string $sessionKey) : void
Internally used method to commit all deferred bindings after saving.
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
inherited protected commitDeferredBefore (string $sessionKey) : void
Internally used method to commit all deferred bindings before saving.
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.
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
inherited
protected
commitDeferredOfType (string $sessionKey, $include = null
, $exclude = null
)
: void
Internal method for committing deferred relations.
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
$include | mixed |
mixed
|
$exclude | mixed |
mixed
|
inherited protected emitterEventSortEvents (string $eventName) : void
Sort the listeners for a given event by priority.
Property | Type | Description |
---|---|---|
$eventName | string |
string
|
inherited protected extendableIsAccessible (mixed $class, string $propertyName) : bool
Checks if a property is accessible, property equivalent of is_callable()
Property | Type | Description |
---|---|---|
$class | mixed |
mixed
|
$propertyName | string |
string
|
inherited protected extensionCallMethod (ReflectionClass $class, string $method, array $params)
Calls a method through reflection.
Property | Type | Description |
---|---|---|
$class | ReflectionClass |
ReflectionClass
|
$method | string |
string
|
$params | array |
array
|
inherited protected extensionExtractMethods (string $extensionName, object $extensionObject) : void
Extracts the available methods from a behavior and adds it to the list of callable methods.
Property | Type | Description |
---|---|---|
$extensionName | string |
string
|
$extensionObject | object |
object
|
inherited protected extensionGetClassLoader () : Winter\Storm\Support\ClassLoader | null
Gets the class loader
inherited
protected
extensionGetParentClass ($instance = null
)
: ReflectionClass | false
Gets the parent class using reflection.
The parent class must either not be the Extendable
class, or must not be using the ExtendableTrait
trait,
in order to prevent infinite loops.
Property | Type | Description |
---|---|---|
$instance | mixed |
mixed
|
inherited protected extensionMethodExists (ReflectionClass $class, string $methodName) : bool
Determines if the given class reflection contains the given method.
Property | Type | Description |
---|---|---|
$class | ReflectionClass |
ReflectionClass
|
$methodName | string |
string
|
inherited protected extensionNormalizeClassName (string $name) : string
Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited protected getDeferrableRelationTypes () : array
Returns all possible relation types that can be deferred.
inherited protected getDeferredBindingRecords (string $sessionKey) : Winter\Storm\Database\Collection
Returns any outstanding binding records for this model.
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
inherited
protected
getMorphs (string $name, string | null $type = null
, string | null $id = null
)
: array
Get the polymorphic relationship columns.
Property | Type | Description |
---|---|---|
$name | string |
string
|
$type | string | null |
string | null
|
$id | string | null |
string | null
|
inherited protected getRelationCaller ()
Finds the calling function name from the stack trace.
inherited protected getRelationDefaults (string $type) : array
Returns default relation arguments for a given type.
Property | Type | Description |
---|---|---|
$type | string |
string
Relation type |
inherited protected getRelationValidationValue ($relationName)
Attachments validate differently to their simple values.
Property | Type | Description |
---|---|---|
$relationName | mixed |
mixed
|
inherited protected getValidationAttributes () : array
Returns the model data used for validation.
inherited protected handleRelation (string $relationName) : Illuminate\Database\Eloquent\Relations\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.
Property | Type | Description |
---|---|---|
$relationName | string |
string
the relation key, camel-case version |
inherited
protected
static
makeValidator ($data, $rules, $customMessages, $attributeNames, $connection = null
)
: Illuminate\Contracts\Validation\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.
Property | Type | Description |
---|---|---|
$data | mixed |
mixed
|
$rules | mixed |
mixed
|
$customMessages | mixed |
mixed
|
$attributeNames | mixed |
mixed
|
$connection | mixed |
mixed
|
inherited protected morphEagerTo (string $name, string $type, string $id, string $ownerKey) : Winter\Storm\Database\Relations\MorphTo
Define a polymorphic, inverse one-to-one or many relationship.
Property | Type | Description |
---|---|---|
$name | string |
string
|
$type | string |
string
|
$id | string |
string
|
$ownerKey | string |
string
|
inherited
protected
morphInstanceTo (string $target, string $name, string $type, string $id, string | null $ownerKey = null
)
: Winter\Storm\Database\Relations\MorphTo
Define a polymorphic, inverse one-to-one or many relationship.
Property | Type | Description |
---|---|---|
$target | string |
string
|
$name | string |
string
|
$type | string |
string
|
$id | string |
string
|
$ownerKey | string | null |
string | null
|
inherited protected newBaseQueryBuilder () : Winter\Storm\Database\QueryBuilder
inherited
protected
parseEventAndPayload (mixed $event, mixed $payload = null
)
: array
Parse the given event and payload and prepare them for dispatching.
Property | Type | Description |
---|---|---|
$event | mixed |
mixed
|
$payload | mixed |
mixed
|
inherited protected performDeleteOnModel () : void
Perform the actual delete query on this model instance.
inherited protected performDeleteOnRelations () : void
Locates relations with delete flag and cascades the delete event.
For pivot relations, detach the pivot record unless the detach flag is false.
inherited protected processRuleFieldNames (array $rules) : array
Processes field names in a rule array.
Converts any field names using array notation (ie. field[child]
) into dot notation (ie. field.child
)
Property | Type | Description |
---|---|---|
$rules | array |
array
Rules array |
inherited protected processValidationRules ($rules)
Process rules
Property | Type | Description |
---|---|---|
$rules | mixed |
mixed
|
inherited protected processValidationUniqueRule (string $definition, string $fieldName) : string
Rebuilds the unique validation rule to force for the existing ID
Property | Type | Description |
---|---|---|
$definition | string |
string
|
$fieldName | string |
string
|
inherited
protected
saveInternal (array $options = []
)
: bool
Save the model to the database. Is used by {@link save()} and {@link forceSave()}.
Property | Type | Description |
---|---|---|
$options | array |
array
|
inherited protected setRelationValue ($relationName, $value)
Sets a relation value directly from its attribute.
Property | Type | Description |
---|---|---|
$relationName | mixed |
mixed
|
$value | mixed |
mixed
|
inherited
protected
validateRelationArgs ($relationName, $optional, array $required = []
)
Validate relation supplied arguments.
Property | Type | Description |
---|---|---|
$relationName | mixed |
mixed
|
$optional | mixed |
mixed
|
$required | array |
array
|
Extended by
Class | Description |
---|---|
User
|
Administrator user model |