AsPivot

Properties

public

$pivotParent Model

The parent model of the relationship.

Default: null
protected

$foreignKey string

The name of the foreign key column.

Default: null
protected

$relatedKey string

The name of the "other key" column.

Default: null

Methods

public static

fromAttributes ( Model $parent , $attributes , $table , $exists ) : static

Create a new pivot model instance.

Parameters

  • $parent Model
  • $attributes array
  • $table string
  • $exists bool
public static

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
protected

setKeysForSelectQuery ( $query ) : Builder

Set the keys for a select query.

Parameters

protected

setKeysForSaveQuery ( $query ) : Builder

Set the keys for a save update query.

Parameters

public

delete ( ) : int

Delete the pivot model record from the database.

protected

getDeleteQuery ( ) : Builder

Get the query builder for a delete operation on the pivot.

public

getTable ( ) : string

Get the table associated with the model.

public

getForeignKey ( ) : string

Get the foreign key column name.

public

getRelatedKey ( ) : string

Get the "related key" column name.

public

getOtherKey ( ) : string

Get the "related key" column name.

public

setPivotKeys ( $foreignKey , $relatedKey ) : $this

Set the key names for the pivot model instance.

Parameters

  • $foreignKey string
  • $relatedKey string
public

hasTimestampAttributes ( $attributes ) : bool

Determine if the pivot model or given attributes has timestamp attributes.

Parameters

  • $attributes array|null
public

getCreatedAtColumn ( ) : string

Get the name of the "created at" column.

public

getUpdatedAtColumn ( ) : string

Get the name of the "updated at" column.

public

getQueueableId ( ) : mixed

Get the queueable identity for the entity.

public

newQueryForRestoration ( $ids ) : Builder

Get a new query to restore one or more models by their queueable IDs.

Parameters

  • $ids int[]|string[]|string
protected

newQueryForCollectionRestoration ( array $ids ) : Builder

Get a new query to restore multiple models by their queueable IDs.

Parameters

  • $ids int[]|string[]
public

unsetRelations ( ) : $this

Unset all the loaded relations for the instance.