class Model implements ExtenderInterface
Methods
<p>Add a custom attribute type cast. Should not be applied to non-extension attributes.</p>
<p>Add a default value for a given attribute, which can be an explicit value, a closure, or an instance of an invokable class. Unlike with some other extenders, it CANNOT be the <code>::class</code> attribute of an invokable class.</p>
<p>Establish a simple belongsTo relationship from this model to another model.</p>
<p>Establish a simple belongsToMany relationship from this model to another model.</p>
<p>Establish a simple hasOne relationship from this model to another model.</p>
<p>Establish a simple hasMany relationship from this model to another model.</p>
<p>Add a relationship from this model to another model.</p>
Details
at
line 28
__construct(string $modelClass)
at
line 40
Model
dateAttribute(string $attribute)
deprecated
deprecated
<p>Add an attribute to be treated as a date.</p>
at
line 54
Model
cast(string $attribute, string $cast)
<p>Add a custom attribute type cast. Should not be applied to non-extension attributes.</p>
at
line 70
Model
default(string $attribute, mixed $value)
<p>Add a default value for a given attribute, which can be an explicit value, a closure, or an instance of an invokable class. Unlike with some other extenders, it CANNOT be the <code>::class</code> attribute of an invokable class.</p>
at
line 90
Model
belongsTo(string $name, string $related, string $foreignKey = null, string $ownerKey = null)
<p>Establish a simple belongsTo relationship from this model to another model.</p>
<p>This represents an inverse one-to-one or inverse one-to-many relationship. For more complex relationships, use the ->relationship method.</p>
at
line 113
Model
belongsToMany(string $name, string $related, string $table = null, string $foreignPivotKey = null, string $relatedPivotKey = null, string $parentKey = null, string $relatedKey = null)
<p>Establish a simple belongsToMany relationship from this model to another model.</p>
<p>This represents a many-to-many relationship. For more complex relationships, use the ->relationship method.</p>
at
line 140
Model
hasOne(string $name, string $related, string $foreignKey = null, string $localKey = null)
<p>Establish a simple hasOne relationship from this model to another model.</p>
<p>This represents a one-to-one relationship. For more complex relationships, use the ->relationship method.</p>
at
line 160
Model
hasMany(string $name, string $related, string $foreignKey = null, string $localKey = null)
<p>Establish a simple hasMany relationship from this model to another model.</p>
<p>This represents a one-to-many relationship. For more complex relationships, use the ->relationship method.</p>