class
Illuminate
/
Database
/
Eloquent
/
Relations
/
MorphOneOrMany
You are viewing an older version of the documentation. For the latest, please visit master documentation.
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
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
protected
setForeignAttributesForCreate ( Model $model ) : void
Set the foreign ID and type for creating a related model.
Parameters
- $model Model
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.