CanBeOneOfMany
trait CanBeOneOfMany (View source)
Properties
protected bool | $isOneOfMany | Determines whether the relationship is one-of-many. | |
protected string | $relationName | The name of the relationship. | |
protected Builder|null | $oneOfManySubQuery | The one of many inner join subselect query builder instance. |
Methods
void | addOneOfManySubQueryConstraints(Builder $query, string|null $column = null, string|null $aggregate = null)
Add constraints for inner join subselect for one of many relationships. | |
array|string | getOneOfManySubQuerySelectColumns()
Get the columns the determine the relationship groups. | |
void | addOneOfManyJoinSubQueryConstraints(JoinClause $join)
Add join query constraints for one of many relationships. | |
$this | ofMany(string|array|null $column = 'id', string|Closure|null $aggregate = 'MAX', string|null $relation = null)
Indicate that the relation is a single result of a larger one-to-many relationship. | |
$this | latestOfMany(string|array|null $column = 'id', string|null $relation = null)
Indicate that the relation is the latest single result of a larger one-to-many relationship. | |
$this | oldestOfMany(string|array|null $column = 'id', string|null $relation = null)
Indicate that the relation is the oldest single result of a larger one-to-many relationship. | |
string | getDefaultOneOfManyJoinAlias(string $relation)
Get the default alias for the one of many inner join clause. | |
Builder | newOneOfManySubQuery(string|array $groupBy, string|null $column = null, string|null $aggregate = null)
Get a new query for the related model, grouping the query by the given column, often the foreign key of the relationship. | |
void | addOneOfManyJoinSubQuery(Builder $parent, Builder $subQuery, string $on)
Add the join subquery to the given query on the given column and the relationship's foreign key. | |
void | mergeOneOfManyJoinsTo(Builder $query)
Merge the relationship query joins to the given query builder. | |
Builder | getRelationQuery()
Get the query builder that will contain the relationship constraints. | |
Builder|void | getOneOfManySubQuery()
Get the one of many inner join subselect builder instance. | |
string | qualifySubSelectColumn(string $column)
Get the qualified column name for the one-of-many relationship using the subselect join query's alias. | |
string | qualifyRelatedColumn(string $column)
Qualify related column using the related table name if it is not already qualified. | |
string | guessRelationship()
Guess the "hasOne" relationship's name via backtrace. | |
bool | isOneOfMany()
Determine whether the relationship is a one-of-many relationship. | |
string | getRelationName()
Get the name of the relationship. |
Details
abstract void addOneOfManySubQueryConstraints(Builder $query, string|null $column = null, string|null $aggregate = null)
Add constraints for inner join subselect for one of many relationships.
abstract array|string getOneOfManySubQuerySelectColumns()
Get the columns the determine the relationship groups.
abstract void addOneOfManyJoinSubQueryConstraints(JoinClause $join)
Add join query constraints for one of many relationships.
$this ofMany(string|array|null $column = 'id', string|Closure|null $aggregate = 'MAX', string|null $relation = null)
Indicate that the relation is a single result of a larger one-to-many relationship.
$this latestOfMany(string|array|null $column = 'id', string|null $relation = null)
Indicate that the relation is the latest single result of a larger one-to-many relationship.
$this oldestOfMany(string|array|null $column = 'id', string|null $relation = null)
Indicate that the relation is the oldest single result of a larger one-to-many relationship.
protected string getDefaultOneOfManyJoinAlias(string $relation)
Get the default alias for the one of many inner join clause.
protected Builder newOneOfManySubQuery(string|array $groupBy, string|null $column = null, string|null $aggregate = null)
Get a new query for the related model, grouping the query by the given column, often the foreign key of the relationship.
protected void addOneOfManyJoinSubQuery(Builder $parent, Builder $subQuery, string $on)
Add the join subquery to the given query on the given column and the relationship's foreign key.
protected void mergeOneOfManyJoinsTo(Builder $query)
Merge the relationship query joins to the given query builder.
protected Builder getRelationQuery()
Get the query builder that will contain the relationship constraints.
Builder|void getOneOfManySubQuery()
Get the one of many inner join subselect builder instance.
string qualifySubSelectColumn(string $column)
Get the qualified column name for the one-of-many relationship using the subselect join query's alias.
protected string qualifyRelatedColumn(string $column)
Qualify related column using the related table name if it is not already qualified.
protected string guessRelationship()
Guess the "hasOne" relationship's name via backtrace.
bool isOneOfMany()
Determine whether the relationship is a one-of-many relationship.
string getRelationName()
Get the name of the relationship.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/9.x/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.html