AsPivot
trait AsPivot (View source)
Properties
Model | $pivotParent | The parent model of the relationship. |
|
protected string | $foreignKey | The name of the foreign key column. |
|
protected string | $relatedKey | The name of the "other key" column. |
Methods
Create a new pivot model instance.
Create a new pivot model from raw values returned from a query.
Set the keys for a select query.
Set the keys for a save update query.
Delete the pivot model record from the database.
Get the query builder for a delete operation on the pivot.
Get the table associated with the model.
Get the foreign key column name.
Get the "related key" column name.
Get the "related key" column name.
Set the key names for the pivot model instance.
Determine if the pivot model or given attributes has timestamp attributes.
Get the name of the "created at" column.
Get the name of the "updated at" column.
Get the queueable identity for the entity.
Get a new query to restore one or more models by their queueable IDs.
Get a new query to restore multiple models by their queueable IDs.
Unset all the loaded relations for the instance.
Details
static AsPivot
fromAttributes(Model $parent, array $attributes, string $table, bool $exists = false)
Create a new pivot model instance.
static AsPivot
fromRawAttributes(Model $parent, array $attributes, string $table, bool $exists = false)
Create a new pivot model from raw values returned from a query.
protected Builder<static>
setKeysForSelectQuery(Builder<static> $query)
Set the keys for a select query.
protected Builder<static>
setKeysForSaveQuery(Builder<static> $query)
Set the keys for a save update query.
int
delete()
Delete the pivot model record from the database.
protected Builder<static>
getDeleteQuery()
Get the query builder for a delete operation on the pivot.
string
getTable()
Get the table associated with the model.
string
getForeignKey()
Get the foreign key column name.
string
getRelatedKey()
Get the "related key" column name.
string
getOtherKey()
Get the "related key" column name.
$this
setPivotKeys(string $foreignKey, string $relatedKey)
Set the key names for the pivot model instance.
bool
hasTimestampAttributes(array|null $attributes = null)
Determine if the pivot model or given attributes has timestamp attributes.
string
getCreatedAtColumn()
Get the name of the "created at" column.
string
getUpdatedAtColumn()
Get the name of the "updated at" column.
mixed
getQueueableId()
Get the queueable identity for the entity.
Builder<static>
newQueryForRestoration(int[]|string[]|string $ids)
Get a new query to restore one or more models by their queueable IDs.
protected Builder<static>
newQueryForCollectionRestoration(array $ids)
Get a new query to restore multiple models by their queueable IDs.
$this
unsetRelations()
Unset all the loaded relations for the instance.