Preferences

User Preferences model

 class Winter\Storm\Auth\Models\Preferences
extends Winter\Storm\Database\Model
implements 
    Winter\Storm\Database\ModelInterface

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.

KeyParser

Key Parser trait

Purgeable

Properties

public $timestamps : mixed

public $userContext : Winter\Storm\Auth\Models\User | null

A user who owns the preferences

protected static $cache : mixed

protected $jsonable : array

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

protected $table : string

The database table used by the model.

public $attachMany : mixed

Inherited from Model

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

public $attachOne : mixed

Inherited from Model

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

public $attributes : array

Inherited from Model

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

public $belongsTo : mixed

Inherited from Model

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

public $belongsToMany : mixed

Inherited from Model

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

public $duplicateCache : bool

Inherited from Model

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

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' ]; }

public $hasManyThrough : mixed

Inherited from Model

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

public $hasOne : mixed

Inherited from Model

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

public $hasOneThrough : mixed

Inherited from Model

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

public $implement : string | array | null

Inherited from Model

Extensions implemented by this class.

public $morphMany : mixed

Inherited from Model

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

public $morphOne : mixed

Inherited from Model

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

public $morphTo : mixed

Inherited from Model

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

public $morphToMany : mixed

Inherited from Model

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

public $morphedByMany : mixed

Inherited from Model

public $sessionKey : string

Inherited from Model

A unique session key used for deferred binding.

public $trimStringAttributes : bool

Inherited from Model

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

protected $dates : array

Inherited from Model

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

protected $emitterEventCollection : array

Inherited from Model

Collection of registered events.

protected $emitterEventSorted : array

Inherited from Model

Sorted collection of events.

protected $emitterSingleEventCollection : array

Inherited from Model

Collection of registered events to be fired once only.

protected static $eventsBooted : array

Inherited from Model

The array of models booted events.

protected static $extendableCallbacks : array

Inherited from Model

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

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

protected static $extendableClassLoader : ClassLoader | null

Inherited from Model

Class loader instance.

protected static $extendableGuardProperties : bool

Inherited from Model

Indicates if dynamic properties can be created.

protected static $extendableStaticMethods : array

Inherited from Model

Collection of static methods used by behaviors.

protected $extensionData : array

Inherited from Model

Class reflection information, including behaviors.

protected $keyParserCache : array

Inherited from KeyParser

A cache of the parsed items.

protected $originalPurgeableValues : array

Inherited from Model

List of original attribute values before they were purged.

protected $purgeable : array

Inherited from Model

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

protected static $relationTypes : array

Inherited from Model

Excepted relationship types, used to cycle and verify relationships.

Methods

public static findRecord ($key, $user = null) : self | null

Returns a record

Parameters
Property Description
$key
mixed
$user
mixed
Returns
self | null

public static forUser ($user = null)

Creates this object and sets the user context

Parameters
Property Description
$user
mixed
Returns
mixed

public get (string $key, mixed $default = null) : mixed

Returns a setting value by the module (or plugin) name and setting name.

Parameters
Property Description
$key
string

Specifies the setting key value, for example 'backend:items.perpage'

$default
mixed

The default value to return if the setting doesn't exist in the DB.

Returns
mixed

Returns the setting value loaded from the database or the default value.

public reset (string $key) : bool

Resets a setting value by deleting the record.

Parameters
Property Description
$key
string

Specifies the setting key value.

Returns
bool

public resolveUser (mixed $user) : User

Checks for a supplied user or uses the default logged in. You should override this method.

Parameters
Property Description
$user
mixed

An optional back-end user object.

Returns
User

object

public scopeApplyKeyAndUser (Winter\Storm\Database\QueryBuilder $query, string $key, mixed $user = null) : mixed

Scope to find a setting record for the specified module (or plugin) name, setting name and user.

Parameters
Property Description
$query
$key
string

Specifies the setting key value, for example 'backend:items.perpage'

$user
mixed

An optional user object.

Returns
mixed

Returns the found record or null.

public set (string $key, mixed $value) : bool

Stores a setting value to the database.

Parameters
Property Description
$key
string

Specifies the setting key value, for example 'backend:items.perpage'

$value
mixed

The setting value to store, serializable. If the user is not provided the currently authenticated user will be used. If there is no an authenticated user, the exception will be thrown.

Returns
bool

protected getCacheKey ($item, $user) : string

Builds a cache key for the preferences record.

Parameters
Property Description
$item
mixed
$user
mixed
Returns
string

public __call ($name, $params)

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

public static __callStatic ($name, $params)

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

public __construct (array $attributes = [])

Inherited from Model

Constructor

Parameters
Property Description
$attributes
array
Returns
mixed

public __get ($name)

Inherited from Model
Parameters
Property Description
$name
mixed
Returns
mixed

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

public __set ($name, $value)

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

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

Inherited from Model

Dynamically add an AttachMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

Inherited from Model

Dynamically add an AttachOne relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

Inherited from Model

Dynamically add a BelongsToMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

Inherited from Model

Dynamically add a BelongsTo relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

public addCasts (array $attributes) : void

Inherited from Model

Add attribute casts for the model.

Parameters
Property Description
$attributes
array
Returns
void

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

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

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

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

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

Inherited from Model

Dynamically add a HasMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

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

Inherited from Model

Dynamically add a HasOne relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

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

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

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

Inherited from Model

Dynamically add a MorphMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

Inherited from Model

Dynamically add a MorphOne relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

Inherited from Model

Dynamically add a MorphToMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

Inherited from Model

Dynamically add a MorphTo relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

Inherited from Model

Dynamically add a MorphedByMany relationship

Parameters
Property Description
$name
string
$config
array
Returns
void

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

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

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

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

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

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

public attributesToArray () : array

Inherited from Model

Convert the model's attributes to an array.

Returns
array

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

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

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

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

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

public static bootPurgeable () : void

Inherited from Model

Boot the purgeable trait for a model.

Returns
void

public cancelDeferred (string $sessionKey) : void

Inherited from Model

Cancel all deferred bindings to this model.

Parameters
Property Description
$sessionKey
string
Returns
void

public static clearExtendedClasses () : void

Inherited from Model

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

Returns
void

public commitDeferred (string $sessionKey) : void

Inherited from Model

Commit all deferred bindings to this model.

Parameters
Property Description
$sessionKey
string
Returns
void

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

public extendClassWith (string $extensionName) : void

Inherited from Model

Dynamically extend a class with a specified behavior

Parameters
Property Description
$extensionName
string
Returns
void

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

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

public extendableConstruct ()

Inherited from Model

This method should be called as part of the constructor.

Returns
mixed

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

public extendableGet (string $name) : mixed | null

Inherited from Model

Magic method for __get()

Parameters
Property Description
$name
string
Returns
mixed | null

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

Inherited from Model

Magic method for __set()

Parameters
Property Description
$name
string
$value
mixed
Returns
void

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

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

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.

public static flushDuplicateCache () : void

Inherited from Model

Flush the memory cache.

Returns
void

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

public freshTimestamp () : Illuminate\Support\Carbon

Inherited from Model

Get a fresh timestamp for the model.

Returns
Illuminate\Support\Carbon

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

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

public getAttributeValue (string $key) : mixed

Inherited from Model

Get a plain attribute (not a relationship).

Parameters
Property Description
$key
string
Returns
mixed

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

public getClassMethods () : array

Inherited from Model

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

Returns
array

public getDynamicProperties () : array

Inherited from Model

Returns all dynamic properties and their values

Returns
array

['property' => 'value']

public getJsonable () : array

Inherited from Model

Get the jsonable attributes name

Returns
array

public getObservableEvents () : array

Inherited from Model

Get the observable event names.

Returns
array

public getOriginalPurgeValue ($attribute)

Inherited from Model

Returns the original values of any purged attributes.

Parameters
Property Description
$attribute
mixed
Returns
mixed

public getOriginalPurgeValues ()

Inherited from Model

Returns the original values of any purged attributes.

Returns
mixed

public getPurgeableAttributes ()

Inherited from Model

Returns a collection of fields that will be hashed.

Returns
mixed

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

public getRelationDefinitions () : array

Inherited from Model

Returns relationship details for all relations defined on this model.

Returns
array

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

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

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

public getRelationValue ($relationName)

Inherited from Model

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

Parameters
Property Description
$relationName
mixed
Returns
mixed

public hasGetMutator (string $key) : bool

Inherited from Model

Determine if a get mutator exists for an attribute.

Parameters
Property Description
$key
string
Returns
bool

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

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

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

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

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

public hasSetMutator (string $key) : bool

Inherited from Model

Determine if a set mutator exists for an attribute.

Parameters
Property Description
$key
string
Returns
bool

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

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

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

public isJsonable ($key) : bool

Inherited from Model

Checks if an attribute is jsonable or not.

Parameters
Property Description
$key
mixed
Returns
bool

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

public jsonable (array $jsonable) : $this

Inherited from Model

Set the jsonable attributes for the model.

Parameters
Property Description
$jsonable
array
Returns
$this

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

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

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

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

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

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

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

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

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

Inherited from Model

Create a new Model Collection instance.

Parameters
Property Description
$models
array
Returns

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

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

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

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

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

public parseKey (string $key) : array

Inherited from KeyParser

Parse a key into namespace, group, and item.

Parameters
Property Description
$key
string
Returns
array

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

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

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

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

Inherited from Model

Reloads the model attributes from the database.

Returns
Illuminate\Database\Eloquent\Model | static

public reloadRelations (string $relationName = null) : void

Inherited from Model

Reloads the model relationship cache.

Parameters
Property Description
$relationName
string
Returns
void

public restorePurgedValues ()

Inherited from Model

Restores the original values of any purged attributes.

Returns
mixed

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

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

public setParsedKey (string $key, array $parsed) : void

Inherited from KeyParser

Set the parsed value of a key.

Parameters
Property Description
$key
string
$parsed
array
Returns
void

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

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

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

protected afterCreate ()

Inherited from Model

Handle the "created" model event

Returns
mixed

protected afterDelete ()

Inherited from Model

Handle the "deleted" model event

Returns
mixed

protected afterFetch ()

Inherited from Model

Handle the "fetched" model event

Returns
mixed

protected afterSave ()

Inherited from Model

Handle the "saved" model event

Returns
mixed

protected afterUpdate ()

Inherited from Model

Handle the "updated" model event

Returns
mixed

protected asDateTime (mixed $value) : Carbon\Carbon

Inherited from Model

Return a timestamp as DateTime object.

Parameters
Property Description
$value
mixed
Returns
Carbon\Carbon

protected beforeCreate ()

Inherited from Model

Handle the "creating" model event

Returns
mixed

protected beforeDelete ()

Inherited from Model

Handle the "deleting" model event

Returns
mixed

protected beforeFetch ()

Inherited from Model

Handle the "fetching" model event

Returns
mixed

protected beforeSave ()

Inherited from Model

Handle the "saving" model event

Returns
mixed

protected beforeUpdate ()

Inherited from Model

Handle the "updating" model event

Returns
mixed

protected bootNicerEvents ()

Inherited from Model

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

Returns
mixed

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

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

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

protected emitterEventSortEvents (string $eventName) : void

Inherited from Model

Sort the listeners for a given event by priority.

Parameters
Property Description
$eventName
string
Returns
void

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

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

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

Inherited from Model

Gets the class loader

Returns
Winter\Storm\Support\ClassLoader | null

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

protected getDeferrableRelationTypes () : array

Inherited from Model

Returns all possible relation types that can be deferred.

Returns
array

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

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

protected getRelationCaller ()

Inherited from Model

Finds the calling function name from the stack trace.

Returns
mixed

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

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

protected keyParserParseBasicSegments (array $segments) : array

Inherited from KeyParser

Parse an array of basic segments.

Parameters
Property Description
$segments
array
Returns
array

protected keyParserParseSegments (string $key) : array

Inherited from KeyParser

Parse an array of namespaced segments.

Parameters
Property Description
$key
string
Returns
array

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

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

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

Inherited from Model

Get a new query builder instance for the connection.

Returns

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

protected performDeleteOnModel () : void

Inherited from Model

Perform the actual delete query on this model instance.

Returns
void

protected performDeleteOnRelations () : void

Inherited from Model

Locates relations with delete flag and cascades the delete event.

Returns
void

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

protected setRelationValue ($relationName, $value)

Inherited from Model

Sets a relation value directly from its attribute.

Parameters
Property Description
$relationName
mixed
$value
mixed
Returns
mixed

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