DeferredBinding

Deferred Binding Model

 class Winter\Storm\Database\Models\DeferredBinding
extends Winter\Storm\Database\Model
implements 
    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
HidesAttributes

Hides and shows attributes for serialization.

Nullable

Enables nullification of empty values on model attributes.

Purgeable

Properties

public $morphTo : mixed

public $table : string

The database table used by the model.

protected $jsonable : array

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

protected $nullable : array

List of attribute names which should be set to null when empty.

inherited public $attachMany : mixed

Inherited from Model

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

inherited public $attachOne : mixed

Inherited from Model

protected $attachOne = [ 'picture' => ['Winter\Storm\Database\Attach\File', 'public' => false] ];

inherited public $attributes : array

Inherited from Model

Make the model's attributes public so behaviors can modify them.

inherited public $belongsTo : mixed

Inherited from Model

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

inherited public $belongsToMany : mixed

Inherited from Model

protected $belongsToMany = [ 'groups' => ['Group', 'table'=> 'join_groups_users'] ];

inherited public $duplicateCache : bool

Inherited from Model

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

inherited public $hasMany : array

Inherited from Model

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

Inherited from Model

protected $hasManyThrough = [ 'posts' => ['Posts', 'through' => 'User'] ];

inherited public $hasOne : mixed

Inherited from Model

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

inherited public $hasOneThrough : mixed

Inherited from Model

protected $hasOneThrough = [ 'post' => ['Posts', 'through' => 'User'] ];

inherited public $implement : string | array | null

Inherited from Model

Extensions implemented by this class.

inherited public $morphMany : mixed

Inherited from Model

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

inherited public $morphOne : mixed

Inherited from Model

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

inherited public $morphToMany : mixed

Inherited from Model

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

inherited public $morphedByMany : mixed

Inherited from Model

inherited public $sessionKey : string

Inherited from Model

A unique session key used for deferred binding.

inherited public $trimStringAttributes : bool

Inherited from Model

Indicates if all string model attributes will be trimmed prior to saving.

inherited protected $dates : array

Inherited from Model

List of datetime attributes to convert to an instance of Carbon/DateTime objects.

inherited protected $emitterEventCollection : array

Inherited from Model

Collection of registered events.

inherited protected $emitterEventSorted : array

Inherited from Model

Sorted collection of events.

inherited protected $emitterSingleEventCollection : array

Inherited from Model

Collection of registered events to be fired once only.

inherited protected static $eventsBooted : array

Inherited from Model

The array of models booted events.

inherited protected static $extendableCallbacks : array

Inherited from Model

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

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

inherited protected static $extendableClassLoader : ClassLoader | null

Inherited from Model

Class loader instance.

inherited protected static $extendableStaticMethods : array

Inherited from Model

Collection of static methods used by behaviors.

inherited protected $extensionData : array

Inherited from Model

Class reflection information, including behaviors.

inherited protected $originalPurgeableValues : array

Inherited from Model

List of original attribute values before they were purged.

inherited protected $purgeable : array

Inherited from Model

List of attributes which should not be saved to the database.

inherited protected static $relationTypes : array

Inherited from Model

Excepted relationship types, used to cycle and verify relationships.

Methods

public beforeCreate ()

Prevents duplicates and conflicting binds.

Returns
mixed

public static cancelDeferredActions (string $masterType, string $sessionKey) : void

Cancel all deferred bindings to this model.

Parameters
Property Description
$masterType
string
$sessionKey
string
Returns
void

public static cleanUp (integer $days = 5) : void

Clean up orphan bindings.

Parameters
Property Description
$days
integer
Returns
void

public deleteCancel () : void

Delete this binding and cancel is actions

Returns
void

protected deleteSlaveRecord () : void

Logic to cancel a bindings action.

Returns
void

protected findBindingRecord ()

Finds a duplicate binding record.

Returns
mixed

inherited public __call ($name, $params)

Inherited from Model
Parameters
Property Description
$name
mixed
$params
mixed
Returns
mixed

inherited public static __callStatic ($name, $params)

Inherited from Model
Parameters
Property Description
$name
mixed
$params
mixed
Returns
mixed

inherited public __construct (array $attributes = [])

Inherited from Model

Constructor

Parameters
Property Description
$attributes
array
Returns
mixed

inherited public __get ($name)

Inherited from Model
Parameters
Property Description
$name
mixed
Returns
mixed

inherited public __isset (string $key) : bool

Inherited from Model

Determine if an attribute or relation exists on the model.

Parameters
Property Description
$key
string
Returns
bool

inherited public __set ($name, $value)

Inherited from Model
Parameters
Property Description
$name
mixed
$value
mixed
Returns
mixed

inherited public addAttachManyRelation (string $name, array $config) : void

Inherited from Model

Dynamically add an AttachMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addAttachOneRelation (string $name, array $config) : void

Inherited from Model

Dynamically add an AttachOne relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addBelongsToManyRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a BelongsToMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addBelongsToRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a BelongsTo relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addCasts (array $attributes) : void

Inherited from Model

Add attribute casts for the model.

Parameters
Property Description
$attributes
array
Returns
void

inherited public addDateAttribute (string $attribute) : void

Inherited from Model

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

Parameters
Property Description
$attribute
string
Returns
void

inherited public addDynamicMethod (string $dynamicName, callable $method, string $extension = null)

Inherited from Model

Programmatically adds a method to the extendable class

Parameters
Property Description
$dynamicName
string
$method
callable
$extension
string
Returns
mixed

inherited public addDynamicProperty (string $dynamicName, mixed $value = null) : void

Inherited from Model

Programmatically adds a property to the extendable class

Parameters
Property Description
$dynamicName
string

The name of the property to add

$value
mixed

The value of the property

Returns
void

inherited public addFillable (array | string | null $attributes = null) : void

Inherited from Model

Add fillable attributes for the model.

Parameters
Property Description
$attributes
array | string | null
Returns
void

inherited public addHasManyRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a HasMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addHasManyThroughRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a(n) HasManyThrough relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addHasOneRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a HasOne relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addHasOneThroughRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a(n) HasOneThrough relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addHidden (array | string | null $attributes = null) : void

Inherited from Model

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.

Parameters
Property Description
$attributes
array | string | null
Returns
void

inherited public addJsonable (array | string | null $attributes = null) : void

Inherited from Model

Add jsonable attributes for the model.

Parameters
Property Description
$attributes
array | string | null
Returns
void

inherited public addMorphManyRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a MorphMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addMorphOneRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a MorphOne relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addMorphToManyRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a MorphToMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addMorphToRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a MorphTo relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addMorphedByManyRelation (string $name, array $config) : void

Inherited from Model

Dynamically add a MorphedByMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

inherited public addNullable (array | string | null $attributes = null) : $this

Inherited from Nullable

Adds an attribute to the nullable attributes list

Parameters
Property Description
$attributes
array | string | null
Returns
$this

inherited public addPurgeable (array | string | null $attributes = null) : $this

Inherited from Model

Adds an attribute to the purgeable attributes list

Parameters
Property Description
$attributes
array | string | null
Returns
$this

inherited public addVisible (array | string | null $attributes = null) : void

Inherited from Model

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.

Parameters
Property Description
$attributes
array | string | null
Returns
void

inherited public alwaysPush (array $options = [], string | null $sessionKey = null) : bool

Inherited from Model

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

Parameters
Property Description
$options
array
$sessionKey
string | null
Returns
bool

inherited public asExtension (string $shortName) : mixed

Inherited from Model

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

$this->asExtension('FormController')

Parameters
Property Description
$shortName
string
Returns
mixed

inherited public attachMany ($related, $isPublic = null, $localKey = null, $relationName = null) : Winter\Storm\Database\Relations\AttachMany

Inherited from Model

Define an attachment one-to-many relationship.

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

Parameters
Property Description
$related
mixed
$isPublic
mixed
$localKey
mixed
$relationName
mixed
Returns

inherited public attachOne ($related, boolean $isPublic = true, $localKey = null, $relationName = null) : Winter\Storm\Database\Relations\AttachOne

Inherited from Model

Define an attachment one-to-one relationship.

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

Parameters
Property Description
$related
mixed
$isPublic
boolean
$localKey
mixed
$relationName
mixed
Returns

inherited public attributesToArray () : array

Inherited from Model

Convert the model's attributes to an array.

Returns
array

inherited public belongsTo ($related, $foreignKey = null, $parentKey = null, $relationName = null) : Winter\Storm\Database\Relations\BelongsTo

Inherited from Model

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.

Parameters
Property Description
$related
mixed
$foreignKey
mixed
$parentKey
mixed
$relationName
mixed
Returns

inherited public belongsToMany ($related, $table = null, $primaryKey = null, $foreignKey = null, $parentKey = null, $relatedKey = null, $relationName = null) : Winter\Storm\Database\Relations\BelongsToMany

Inherited from Model

Define a many-to-many relationship.

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

Parameters
Property Description
$related
mixed
$table
mixed
$primaryKey
mixed
$foreignKey
mixed
$parentKey
mixed
$relatedKey
mixed
$relationName
mixed
Returns

inherited public bindDeferred (string $relation, Illuminate\Database\Eloquent\Model $record, string $sessionKey, array $pivotData = []) : Winter\Storm\Database\Models\DeferredBinding

Inherited from Model

Bind a deferred relationship to the supplied record.

Parameters
Property Description
$relation
string
$record
Illuminate\Database\Eloquent\Model
$sessionKey
string
$pivotData
array
Returns
Winter\Storm\Database\Models\DeferredBinding

inherited public bindEvent (string | Closure | QueuedClosure $event, mixed $callback = null, integer $priority) : self

Inherited from Model

Create a new event binding.

Parameters
Property Description
$event
string | Closure | QueuedClosure
$callback
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
Returns
self

inherited public bindEventOnce (string | Closure | QueuedClosure $event, QueuedClosure | Closure | null $callback = null) : self

Inherited from Model

Create a new event binding that fires once only

Parameters
Property Description
$event
string | Closure | QueuedClosure
$callback
QueuedClosure | Closure | null

When a Closure or QueuedClosure is provided as the first parameter this parameter can be omitted

Returns
self

inherited public static bootNullable () : void

Inherited from Nullable

Boot the nullable trait for a model

Returns
void

inherited public static bootPurgeable () : void

Inherited from Model

Boot the purgeable trait for a model.

Returns
void

inherited public cancelDeferred (string $sessionKey) : void

Inherited from Model

Cancel all deferred bindings to this model.

Parameters
Property Description
$sessionKey
string
Returns
void

inherited public checkNullableValue (mixed $value) : bool

Inherited from Nullable

Checks if the supplied value is empty, excluding zero.

Parameters
Property Description
$value
mixed

Value to check

Returns
bool

inherited public static clearExtendedClasses () : void

Inherited from Model

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

Returns
void

inherited public commitDeferred (string $sessionKey) : void

Inherited from Model

Commit all deferred bindings to this model.

Parameters
Property Description
$sessionKey
string
Returns
void

inherited public static create (array $attributes = [], string $sessionKey = null) : Illuminate\Database\Eloquent\Model | static

Inherited from Model

Save a new model and return the instance.

Parameters
Property Description
$attributes
array
$sessionKey
string
Returns
Illuminate\Database\Eloquent\Model | static

inherited public extendClassWith (string $extensionName) : void

Inherited from Model

Dynamically extend a class with a specified behavior

Parameters
Property Description
$extensionName
string
Returns
void

inherited public extendableCall (string $name, array $params = null) : mixed

Inherited from Model

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
Parameters
Property Description
$name
string
$params
array
Returns
mixed

inherited public static extendableCallStatic (string $name, array $params = null) : mixed

Inherited from Model

Magic method for __callStatic()

Parameters
Property Description
$name
string
$params
array
Returns
mixed

inherited public extendableConstruct ()

Inherited from Model

This method should be called as part of the constructor.

Returns
mixed

inherited public static extendableExtendCallback (callable $callback, boolean $scoped = false, $outerScope = null) : void

Inherited from Model

Helper method for ::extend() static method.

Parameters
Property Description
$callback
callable
$scoped
boolean
$outerScope
mixed
Returns
void

inherited public extendableGet (string $name) : mixed | null

Inherited from Model

Magic method for __get()

Parameters
Property Description
$name
string
Returns
mixed | null

inherited public extendableSet (string $name, mixed $value) : void

Inherited from Model

Magic method for __set()

Parameters
Property Description
$name
string
$value
mixed
Returns
void

inherited public static fetched (Closure | string $callback) : void

Inherited from Model

Create a new native event for handling afterFetch().

Parameters
Property Description
$callback
Closure | string
Returns
void

inherited public static fetching (Closure | string $callback) : void

Inherited from Model

Create a new native event for handling beforeFetch().

Parameters
Property Description
$callback
Closure | string
Returns
void

inherited public fireEvent (string $event, array $params = [], boolean $halt = false) : array | mixed | null

Inherited from Model

Fire an event and call the listeners.

Parameters
Property Description
$event
string

Event name

$params
array

Event parameters

$halt
boolean

Halt after first non-null result

Returns
array | mixed | null

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

Inherited from Model

Flush the memory cache.

Returns
void

inherited public static flushEventListeners () : void

Inherited from Model

Remove all of the event listeners for the model Also flush registry of models that had events booted Allows painless unit testing.

Returns
void

inherited public freshTimestamp () : Illuminate\Support\Carbon

Inherited from Model

Get a fresh timestamp for the model.

Returns
Illuminate\Support\Carbon

inherited public fromDateTime (DateTime | int | null $value = null) : string | null

Inherited from Model

Convert a DateTime to a storable string.

Parameters
Property Description
$value
DateTime | int | null
Returns
string | null

inherited public getAttribute (string $key) : mixed

Inherited from Model

Get an attribute from the model.

Overrides {@link Eloquent} to support loading from property-defined relations.

Parameters
Property Description
$key
string
Returns
mixed

inherited public getAttributeValue (string $key) : mixed

Inherited from Model

Get a plain attribute (not a relationship).

Parameters
Property Description
$key
string
Returns
mixed

inherited public getClassExtension (string $name) : mixed

Inherited from Model

Returns a behavior object from an extendable class, example:

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

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
mixed

inherited public getClassMethods () : array

Inherited from Model

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

Returns
array

inherited public getDynamicProperties () : array

Inherited from Model

Returns all dynamic properties and their values

Returns
array

['property' => 'value']

inherited public getJsonable () : array

Inherited from Model

Get the jsonable attributes name

Returns
array

inherited public getObservableEvents () : array

Inherited from Model

Get the observable event names.

Returns
array

inherited public getOriginalPurgeValue ($attribute)

Inherited from Model

Returns the original values of any purged attributes.

Parameters
Property Description
$attribute
mixed
Returns
mixed

inherited public getOriginalPurgeValues ()

Inherited from Model

Returns the original values of any purged attributes.

Returns
mixed

inherited public getPurgeableAttributes ()

Inherited from Model

Returns a collection of fields that will be hashed.

Returns
mixed

inherited public getRelationDefinition (string $name) : array | null

Inherited from Model

Returns relationship details from a supplied name.

Parameters
Property Description
$name
string

Relation name

Returns
array | null

inherited public getRelationDefinitions () : array

Inherited from Model

Returns relationship details for all relations defined on this model.

Returns
array

inherited public getRelationType (string $name) : string | null

Inherited from Model

Returns a relationship type based on a supplied name.

Parameters
Property Description
$name
string
Returns
string | null

inherited public getRelationTypeDefinition (string $type, string $name) : string | null

Inherited from Model

Returns the given relation definition.

Parameters
Property Description
$type
string

Relation type

$name
string

Relation name

Returns
string | null

inherited public getRelationTypeDefinitions (string $type) : array | string | null

Inherited from Model

Returns all defined relations of given type.

Parameters
Property Description
$type
string

Relation type

Returns
array | string | null

inherited public getRelationValue ($relationName)

Inherited from Model

Returns a relation key value(s), not as an object.

Parameters
Property Description
$relationName
mixed
Returns
mixed

inherited public hasAttribute (string $key) : bool

Inherited from Model

Determine if the given attribute will be processed by getAttributeValue().

Parameters
Property Description
$key
string
Returns
bool

inherited public static hasDatabaseTable () : bool

Inherited from Model

Static helper for isDatabaseReady()

Returns
bool

inherited public hasGetMutator (string $key) : bool

Inherited from Model

Determine if a get mutator exists for an attribute.

Parameters
Property Description
$key
string
Returns
bool

inherited public hasMany ($related, $primaryKey = null, $localKey = null, $relationName = null) : Winter\Storm\Database\Relations\HasMany

Inherited from Model

Define a one-to-many relationship.

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

Parameters
Property Description
$related
mixed
$primaryKey
mixed
$localKey
mixed
$relationName
mixed
Returns

inherited public hasManyThrough ($related, $through, $primaryKey = null, $throughKey = null, $localKey = null, $secondLocalKey = null, $relationName = null) : Winter\Storm\Database\Relations\HasManyThrough

Inherited from Model

Define a has-many-through relationship.

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

Parameters
Property Description
$related
mixed
$through
mixed
$primaryKey
mixed
$throughKey
mixed
$localKey
mixed
$secondLocalKey
mixed
$relationName
mixed
Returns

inherited public hasOne ($related, $primaryKey = null, $localKey = null, $relationName = null) : Winter\Storm\Database\Relations\HasOne

Inherited from Model

Define a one-to-one relationship.

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

Parameters
Property Description
$related
mixed
$primaryKey
mixed
$localKey
mixed
$relationName
mixed
Returns

inherited public hasOneThrough ($related, $through, $primaryKey = null, $throughKey = null, $localKey = null, $secondLocalKey = null, $relationName = null) : Winter\Storm\Database\Relations\HasOneThrough

Inherited from Model

Define a has-one-through relationship.

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

Parameters
Property Description
$related
mixed
$through
mixed
$primaryKey
mixed
$throughKey
mixed
$localKey
mixed
$secondLocalKey
mixed
$relationName
mixed
Returns

inherited public hasRelation (string $name) : bool

Inherited from Model

Checks if model has a relationship by supplied name.

Parameters
Property Description
$name
string

Relation name

Returns
bool

inherited public hasSetMutator (string $key) : bool

Inherited from Model

Determine if a set mutator exists for an attribute.

Parameters
Property Description
$key
string
Returns
bool

inherited public isClassExtendedWith (string $name) : bool

Inherited from Model

Check if extendable class is extended with a behavior object

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
bool

inherited public isDatabaseReady () : bool

Inherited from Model

Check if the model's database connection is ready

Returns
bool

inherited public isDeferrable (string $relationName) : bool

Inherited from Model

Returns true if a relation exists and can be deferred.

Parameters
Property Description
$relationName
string
Returns
bool

inherited public isGuarded (string $key) : bool

Inherited from Model

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.

Parameters
Property Description
$key
string
Returns
bool

inherited public isJsonable ($key) : bool

Inherited from Model

Checks if an attribute is jsonable or not.

Parameters
Property Description
$key
mixed
Returns
bool

inherited public isRelationPushable (string $name) : bool

Inherited from Model

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

Parameters
Property Description
$name
string

Relation name

Returns
bool

inherited public jsonable (array $jsonable) : $this

Inherited from Model

Set the jsonable attributes for the model.

Parameters
Property Description
$jsonable
array
Returns
$this

inherited public static make (array $attributes = []) : Illuminate\Database\Eloquent\Model | static

Inherited from Model

Create a new model and return the instance.

Parameters
Property Description
$attributes
array
Returns
Illuminate\Database\Eloquent\Model | static

inherited public makeRelation (string $name) : Winter\Storm\Database\Model | null

Inherited from Model

Returns a new instance of a related model

Parameters
Property Description
$name
string
Returns
Winter\Storm\Database\Model | null

inherited public methodExists (string $name) : bool

Inherited from Model

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

Parameters
Property Description
$name
string
Returns
bool

inherited public morphMany ($related, $name, $type = null, $id = null, $localKey = null, $relationName = null) : Winter\Storm\Database\Relations\MorphMany

Inherited from Model

Define a polymorphic one-to-many relationship.

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

Parameters
Property Description
$related
mixed
$name
mixed
$type
mixed
$id
mixed
$localKey
mixed
$relationName
mixed
Returns

inherited public morphOne ($related, $name, $type = null, $id = null, $localKey = null, $relationName = null) : Winter\Storm\Database\Relations\MorphOne

Inherited from Model

Define a polymorphic one-to-one relationship.

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

Parameters
Property Description
$related
mixed
$name
mixed
$type
mixed
$id
mixed
$localKey
mixed
$relationName
mixed
Returns

inherited public morphTo ($name = null, $type = null, $id = null, $ownerKey = null) : Winter\Storm\Database\Relations\MorphTo

Inherited from Model

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.

Parameters
Property Description
$name
mixed
$type
mixed
$id
mixed
$ownerKey
mixed
Returns

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

Inherited from Model

Define a polymorphic many-to-many relationship.

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

Parameters
Property Description
$related
mixed
$name
mixed
$table
mixed
$primaryKey
mixed
$foreignKey
mixed
$parentKey
mixed
$relatedKey
mixed
$inverse
boolean
$relationName
mixed
Returns

inherited public morphedByMany ($related, $name, $table = null, $primaryKey = null, $foreignKey = null, $parentKey = null, $relatedKey = null, $relationName = null) : Winter\Storm\Database\Relations\MorphToMany

Inherited from Model

Define a polymorphic many-to-many inverse relationship.

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

Parameters
Property Description
$related
mixed
$name
mixed
$table
mixed
$primaryKey
mixed
$foreignKey
mixed
$parentKey
mixed
$relatedKey
mixed
$relationName
mixed
Returns

inherited public newCollection (array $models = []) : Winter\Storm\Database\Collection

Inherited from Model

Create a new Model Collection instance.

Parameters
Property Description
$models
array
Returns

inherited public newEloquentBuilder (Winter\Storm\Database\QueryBuilder $query) : Winter\Storm\Database\Builder

Inherited from Model

Create a new Eloquent query builder for the model.

Parameters
Returns

inherited public newFromBuilder (array $attributes = [], $connection = null) : Illuminate\Database\Eloquent\Model | static

Inherited from Model

Create a new model instance that is existing.

Parameters
Property Description
$attributes
array
$connection
mixed
Returns
Illuminate\Database\Eloquent\Model | static

inherited public newPivot (Illuminate\Database\Eloquent\Model $parent, array $attributes, string $table, bool $exists, string | null $using = null) : Winter\Storm\Database\Pivot

Inherited from Model

Create a generic pivot model instance.

Parameters
Property Description
$parent
Illuminate\Database\Eloquent\Model
$attributes
array
$table
string
$exists
bool
$using
string | null
Returns

inherited public newRelationPivot (string $relationName, Winter\Storm\Database\Model $parent, array $attributes, string $table, bool $exists) : Winter\Storm\Database\Pivot | null

Inherited from Model

Create a pivot model instance specific to a relation.

Parameters
Property Description
$relationName
string
$parent
$attributes
array
$table
string
$exists
bool
Returns

inherited public nullableBeforeSave () : void

Inherited from Nullable

Nullify empty fields

Returns
void

inherited public offsetExists (mixed $offset) : bool

Inherited from Model

This a custom piece of logic specifically to satisfy Twig's desire to return a relation object instead of loading the related model.

Parameters
Property Description
$offset
mixed
Returns
bool

inherited public propertyExists (string $name) : bool

Inherited from Model

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

Parameters
Property Description
$name
string
Returns
bool

inherited public purgeAttributes (array | string $attributesToPurge = null) : array

Inherited from Model

Removes purged attributes from the dataset, used before saving.

Parameters
Property Description
$attributesToPurge
array | string

Attribute(s) to purge, if unspecified, $purgable property is used

Returns
array

Current attribute set

inherited public push (array $options = [], string | null $sessionKey = null) : bool

Inherited from Model

Save the model and all of its relationships.

Parameters
Property Description
$options
array
$sessionKey
string | null
Returns
bool

inherited public reload () : Illuminate\Database\Eloquent\Model | static

Inherited from Model

Reloads the model attributes from the database.

Returns
Illuminate\Database\Eloquent\Model | static

inherited public reloadRelations (string $relationName = null) : void

Inherited from Model

Reloads the model relationship cache.

Parameters
Property Description
$relationName
string
Returns
void

inherited public restorePurgedValues ()

Inherited from Model

Restores the original values of any purged attributes.

Returns
mixed

inherited public save (array $options = [], string | null $sessionKey = null) : bool

Inherited from Model

Save the model to the database.

Parameters
Property Description
$options
array
$sessionKey
string | null
Returns
bool

inherited public setAttribute (string $key, mixed $value) : mixed | null

Inherited from Model

Set a given attribute on the model.

Parameters
Property Description
$key
string
$value
mixed
Returns
mixed | null

inherited public unbindDeferred (string $relation, Illuminate\Database\Eloquent\Model $record, string $sessionKey) : Winter\Storm\Database\Models\DeferredBinding

Inherited from Model

Unbind a deferred relationship to the supplied record.

Parameters
Property Description
$relation
string
$record
Illuminate\Database\Eloquent\Model
$sessionKey
string
Returns
Winter\Storm\Database\Models\DeferredBinding

inherited public unbindEvent (string | array | object $event = null) : self

Inherited from Model

Destroys an event binding.

Parameters
Property Description
$event
string | array | object

Event to destroy

Returns
self

inherited protected addRelation (string $type, string $name, array $config) : void

Inherited from Model

Dynamically add the provided relationship configuration to the local properties

Parameters
Property Description
$type
string
$name
string
$config
array
Returns
void

inherited protected afterCreate ()

Inherited from Model

Handle the "created" model event

Returns
mixed

inherited protected afterDelete ()

Inherited from Model

Handle the "deleted" model event

Returns
mixed

inherited protected afterFetch ()

Inherited from Model

Handle the "fetched" model event

Returns
mixed

inherited protected afterSave ()

Inherited from Model

Handle the "saved" model event

Returns
mixed

inherited protected afterUpdate ()

Inherited from Model

Handle the "updated" model event

Returns
mixed

inherited protected asDateTime (mixed $value) : Carbon\Carbon

Inherited from Model

Return a timestamp as DateTime object.

Parameters
Property Description
$value
mixed
Returns
Carbon\Carbon

inherited protected beforeDelete ()

Inherited from Model

Handle the "deleting" model event

Returns
mixed

inherited protected beforeFetch ()

Inherited from Model

Handle the "fetching" model event

Returns
mixed

inherited protected beforeSave ()

Inherited from Model

Handle the "saving" model event

Returns
mixed

inherited protected beforeUpdate ()

Inherited from Model

Handle the "updating" model event

Returns
mixed

inherited protected bootNicerEvents ()

Inherited from Model

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

Returns
mixed

inherited protected commitDeferredAfter (string $sessionKey) : void

Inherited from Model

Internally used method to commit all deferred bindings after saving.

Parameters
Property Description
$sessionKey
string
Returns
void

inherited protected commitDeferredBefore (string $sessionKey) : void

Inherited from Model

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.

Parameters
Property Description
$sessionKey
string
Returns
void

inherited protected commitDeferredOfType (string $sessionKey, $include = null, $exclude = null) : void

Inherited from Model

Internal method for committing deferred relations.

Parameters
Property Description
$sessionKey
string
$include
mixed
$exclude
mixed
Returns
void

inherited protected emitterEventSortEvents (string $eventName) : void

Inherited from Model

Sort the listeners for a given event by priority.

Parameters
Property Description
$eventName
string
Returns
void

inherited protected extendableIsAccessible (mixed $class, string $propertyName) : bool

Inherited from Model

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

Parameters
Property Description
$class
mixed
$propertyName
string
Returns
bool

inherited protected extensionCallMethod (ReflectionClass $class, string $method, array $params)

Inherited from Model

Calls a method through reflection.

Parameters
Property Description
$class
ReflectionClass
$method
string
$params
array
Returns
mixed

inherited protected extensionExtractMethods (string $extensionName, object $extensionObject) : void

Inherited from Model

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

Parameters
Property Description
$extensionName
string
$extensionObject
object
Returns
void

inherited protected extensionGetClassLoader () : Winter\Storm\Support\ClassLoader | null

Inherited from Model

Gets the class loader

Returns
Winter\Storm\Support\ClassLoader | null

inherited protected extensionGetParentClass ($instance = null) : ReflectionClass | false

Inherited from Model

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.

Parameters
Property Description
$instance
mixed
Returns
ReflectionClass | false

inherited protected extensionMethodExists (ReflectionClass $class, string $methodName) : bool

Inherited from Model

Determines if the given class reflection contains the given method.

Parameters
Property Description
$class
ReflectionClass
$methodName
string
Returns
bool

inherited protected extensionNormalizeClassName (string $name) : string

Inherited from Model

Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes

Parameters
Property Description
$name
string
Returns
string

inherited protected getDeferrableRelationTypes () : array

Inherited from Model

Returns all possible relation types that can be deferred.

Returns
array

inherited protected getDeferredBindingRecords (string $sessionKey) : Winter\Storm\Database\Collection

Inherited from Model

Returns any outstanding binding records for this model.

Parameters
Property Description
$sessionKey
string
Returns
Winter\Storm\Database\Collection

inherited protected getMorphs (string $name, string | null $type = null, string | null $id = null) : array

Inherited from Model

Get the polymorphic relationship columns.

Parameters
Property Description
$name
string
$type
string | null
$id
string | null
Returns
array

inherited protected getRelationCaller ()

Inherited from Model

Finds the calling function name from the stack trace.

Returns
mixed

inherited protected getRelationDefaults (string $type) : array

Inherited from Model

Returns default relation arguments for a given type.

Parameters
Property Description
$type
string

Relation type

Returns
array

inherited protected handleRelation (string $relationName) : Illuminate\Database\Eloquent\Relations\Relation

Inherited from Model

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.

Parameters
Property Description
$relationName
string

the relation key, camel-case version

Returns
Illuminate\Database\Eloquent\Relations\Relation

inherited protected morphEagerTo (string $name, string $type, string $id, string $ownerKey) : Winter\Storm\Database\Relations\MorphTo

Inherited from Model

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

Parameters
Property Description
$name
string
$type
string
$id
string
$ownerKey
string
Returns

inherited protected morphInstanceTo (string $target, string $name, string $type, string $id, string | null $ownerKey = null) : Winter\Storm\Database\Relations\MorphTo

Inherited from Model

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

Parameters
Property Description
$target
string
$name
string
$type
string
$id
string
$ownerKey
string | null
Returns

inherited protected newBaseQueryBuilder () : Winter\Storm\Database\QueryBuilder

Inherited from Model

Get a new query builder instance for the connection.

Returns

inherited protected parseEventAndPayload (mixed $event, mixed $payload = null) : array

Inherited from Model

Parse the given event and payload and prepare them for dispatching.

Parameters
Property Description
$event
mixed
$payload
mixed
Returns
array

inherited protected performDeleteOnModel () : void

Inherited from Model

Perform the actual delete query on this model instance.

Returns
void

inherited protected performDeleteOnRelations () : void

Inherited from Model

Locates relations with delete flag and cascades the delete event.

For pivot relations, detach the pivot record unless the detach flag is false.

Returns
void

inherited protected saveInternal (array $options = []) : bool

Inherited from Model

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

Parameters
Property Description
$options
array
Returns
bool

inherited protected setRelationValue ($relationName, $value)

Inherited from Model

Sets a relation value directly from its attribute.

Parameters
Property Description
$relationName
mixed
$value
mixed
Returns
mixed

inherited protected validateRelationArgs ($relationName, $optional, array $required = [])

Inherited from Model

Validate relation supplied arguments.

Parameters
Property Description
$relationName
mixed
$optional
mixed
$required
array
Returns
mixed
Copyright © 2024 Winter CMS