trait Illuminate / Database / Eloquent / Relations / Concerns / CanBeOneOfMany

CanBeOneOfMany

Properties

protected

$isOneOfMany bool

Determines whether the relationship is one-of-many.

Default: false
protected

$relationName string

The name of the relationship.

Default: null
protected

$oneOfManySubQuery Builder |null

The one of many inner join subselect query builder instance.

Default: null

Methods

public abstract

addOneOfManySubQueryConstraints ( Builder $query , $column , $aggregate ) : void

Add constraints for inner join subselect for one of many relationships.

Parameters

  • $query Builder
  • $column string|null
  • $aggregate string|null
public abstract

getOneOfManySubQuerySelectColumns ( ) : array|string

Get the columns the determine the relationship groups.

public abstract

addOneOfManyJoinSubQueryConstraints ( JoinClause $join ) : void

Add join query constraints for one of many relationships.

Parameters

public

ofMany ( $column , $aggregate , $relation ) : $this

Indicate that the relation is a single result of a larger one-to-many relationship.

Parameters

  • $column string|array|null
  • $aggregate string|Closure |null
  • $relation string|null
public

latestOfMany ( $column , $relation ) : $this

Indicate that the relation is the latest single result of a larger one-to-many relationship.

Parameters

  • $column string|array|null
  • $relation string|null
public

oldestOfMany ( $column , $relation ) : $this

Indicate that the relation is the oldest single result of a larger one-to-many relationship.

Parameters

  • $column string|array|null
  • $relation string|null
protected

getDefaultOneOfManyJoinAlias ( $relation ) : string

Get the default alias for the one of many inner join clause.

Parameters

  • $relation string
protected

newOneOfManySubQuery ( $groupBy , $column , $aggregate ) : Builder

Get a new query for the related model, grouping the query by the given column, often the foreign key of the relationship.

Parameters

  • $groupBy string|array
  • $column string|null
  • $aggregate string|null
protected

addOneOfManyJoinSubQuery ( Builder $parent , Builder $subQuery , $on ) : void

Add the join subquery to the given query on the given column and the relationship's foreign key.

Parameters

protected

mergeOneOfManyJoinsTo ( Builder $query ) : void

Merge the relationship query joins to the given query builder.

Parameters

protected

getRelationQuery ( ) : Builder

Get the query builder that will contain the relationship constraints.

public

getOneOfManySubQuery ( ) : Builder |void

Get the one of many inner join subselect builder instance.

public

qualifySubSelectColumn ( $column ) : string

Get the qualified column name for the one-of-many relationship using the subselect join query's alias.

Parameters

  • $column string
protected

qualifyRelatedColumn ( $column ) : string

Qualify related column using the related table name if it is not already qualified.

Parameters

  • $column string
protected

guessRelationship ( ) : string

Guess the "hasOne" relationship's name via backtrace.

public

isOneOfMany ( ) : bool

Determine whether the relationship is a one-of-many relationship.

public

getRelationName ( ) : string

Get the name of the relationship.