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