class Illuminate / Database / Eloquent / Relations / MorphOneOrMany
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.
abstract

MorphOneOrMany

Extends

Properties

protected

$morphType string

The foreign key type for the relationship.

Default: null
protected

$morphClass string

The class name of the parent model.

Default: null

Methods

public

__construct ( Builder $query , Model $parent , $type , $id , $localKey ) : void

Create a new morph one or many relationship instance.

Parameters

  • $query Builder
  • $parent Model
  • $type string
  • $id string
  • $localKey string
public

addConstraints ( ) : void

Set the base constraints on the relation query.

public

addEagerConstraints ( array $models ) : void

Set the constraints for an eager load of the relation.

Parameters

  • $models array
public

forceCreate ( array $attributes ) : Model

Create a new instance of the related model. Allow mass-assignment.

Parameters

  • $attributes array
protected

setForeignAttributesForCreate ( Model $model ) : void

Set the foreign ID and type for creating a related model.

Parameters

public

getRelationExistenceQuery ( Builder $query , Builder $parentQuery , $columns ) : Builder

Get the relationship query.

Parameters

public

getQualifiedMorphType ( ) : string

Get the foreign key "type" name.

public

getMorphType ( ) : string

Get the plain morph type name without the table.

public

getMorphClass ( ) : string

Get the class name of the parent model.