MorphPivot
Reimplementation of \Illuminate\Database\Eloquent\Relations\MorphPivot
but extends Winter's Pivot base class instead of Laravel's to get access to
Winter magic.
class Winter\Storm\Database\MorphPivot
extends Winter\Storm\Database\Pivot
implements
Winter\Storm\Database\ModelInterface
Extends
Class | Description |
---|---|
Pivot
|
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. |
Illuminate\Database\Eloquent\Relations\Concerns\AsPivot
|
|
Purgeable
|
Properties
protected $morphClass : string
The value of the polymorphic relation.
Explicitly define this so it's not included in saved attributes.
protected $morphType : string
The type of the polymorphic relation.
Explicitly define this so it's not included in saved attributes.
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
$belongsTo
:
mixed
= []
protected $belongsTo = [ 'parent' => ['Category', 'key' => 'parent_id'] ];
inherited
public
$belongsToMany
:
mixed
= []
protected $belongsToMany = [ 'groups' => ['Group', 'table'=> 'join_groups_users'] ];
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
$incrementing
:
bool
= false
Indicates if the IDs are auto-incrementing.
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
$dates
:
array
= []
List of datetime attributes to convert to an instance of Carbon/DateTime objects.
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
$guarded
:
string[]
|
bool
= []
The attributes that aren't mass assignable.
inherited
protected
$jsonable
:
array
= []
List of attribute names which are json encoded and decoded from the database.
inherited
protected
$originalPurgeableValues
:
array
= []
List of original attribute values before they were purged.
inherited
protected
$purgeable
:
array
= []
List of attributes which should not be saved to the database.
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.
Methods
public delete () : int
Delete the pivot model record from the database.
public getMorphType () : string
Get the morph type for the pivot.
public getQueueableId () : mixed
Get the queueable identity for the entity.
public newQueryForRestoration (array | int $ids) : Illuminate\Database\Eloquent\Builder
Get a new query to restore one or more models by their queueable IDs.
Property | Type | Description |
---|---|---|
$ids | array | int |
array | int
|
public setMorphClass (string $morphClass) : Winter\Storm\Database\MorphPivot
Set the morph class for the pivot.
Property | Type | Description |
---|---|---|
$morphClass | string |
string
|
public setMorphType (string $morphType) : $this
Set the morph type for the pivot.
Property | Type | Description |
---|---|---|
$morphType | string |
string
|
protected newQueryForCollectionRestoration (array $ids) : Illuminate\Database\Eloquent\Builder
Get a new query to restore multiple models by their queueable IDs.
Property | Type | Description |
---|---|---|
$ids | array |
array
|
protected setKeysForSaveQuery (Illuminate\Database\Eloquent\Builder $query) : Illuminate\Database\Eloquent\Builder
Set the keys for a save update query.
Property | Type | Description |
---|---|---|
$query | Illuminate\Database\Eloquent\Builder |
Illuminate\Database\Eloquent\Builder
|
protected setKeysForSelectQuery (Illuminate\Database\Eloquent\Builder $query) : Illuminate\Database\Eloquent\Builder
Set the keys for a select query.
Property | Type | Description |
---|---|---|
$query | Illuminate\Database\Eloquent\Builder |
Illuminate\Database\Eloquent\Builder
|
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
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 bootPurgeable () : void
Boot the purgeable trait for a model.
inherited public cancelDeferred (string $sessionKey) : void
Cancel all deferred bindings to this model.
Property | Type | Description |
---|---|---|
$sessionKey | string |
string
|
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 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 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 getJsonable () : array
Get the jsonable attributes name
inherited public getObservableEvents () : array
Get the observable event names.
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 getParentAttribute (mixed $value) : Illuminate\Database\Eloquent\Model | null
Gets the parent attribute.
Provided for backwards-compatibility.
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
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 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 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 setParentAttribute (Illuminate\Database\Eloquent\Model $value) : void
Sets the parent attribute.
Provided for backwards-compatibility.
Property | Type | Description |
---|---|---|
$value | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
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 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 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 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
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
|