class Model implements ExtenderInterface
Methods
<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 27
__construct(string $modelClass)
at
line 61
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 81
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 104
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 131
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 151
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>