dep: package update

This commit is contained in:
2021-11-08 16:10:01 +09:00
parent 38208750e7
commit 2c533d2ab3
783 changed files with 4581 additions and 20980 deletions
@@ -277,7 +277,7 @@ class BelongsToMany extends Relation
// Once we have an array dictionary of child objects we can easily match the
// children back to their parent using the dictionary and the keys on the
// the parent models. Then we will return the hydrated models back out.
// parent models. Then we should return these hydrated models back out.
foreach ($models as $model) {
$key = $this->getDictionaryKey($model->{$this->parentKey});
@@ -102,7 +102,9 @@ trait CanBeOneOfMany
if (isset($previous)) {
$this->addOneOfManyJoinSubQuery($subQuery, $previous['subQuery'], $previous['column']);
} elseif (isset($closure)) {
}
if (isset($closure)) {
$closure($subQuery);
}
@@ -122,6 +124,12 @@ trait CanBeOneOfMany
$this->addConstraints();
$columns = $this->query->getQuery()->columns;
if (is_null($columns) || $columns === ['*']) {
$this->select([$this->qualifyColumn('*')]);
}
return $this;
}
@@ -137,7 +145,7 @@ trait CanBeOneOfMany
{
return $this->ofMany(collect(Arr::wrap($column))->mapWithKeys(function ($column) {
return [$column => 'MAX'];
})->all(), 'MAX', $relation ?: $this->guessRelationship());
})->all(), 'MAX', $relation);
}
/**
@@ -152,7 +160,7 @@ trait CanBeOneOfMany
{
return $this->ofMany(collect(Arr::wrap($column))->mapWithKeys(function ($column) {
return [$column => 'MIN'];
})->all(), 'MIN', $relation ?: $this->guessRelationship());
})->all(), 'MIN', $relation);
}
/**
@@ -179,14 +187,15 @@ trait CanBeOneOfMany
protected function newOneOfManySubQuery($groupBy, $column = null, $aggregate = null)
{
$subQuery = $this->query->getModel()
->newQuery();
->newQuery()
->withoutGlobalScopes($this->removedScopes());
foreach (Arr::wrap($groupBy) as $group) {
$subQuery->groupBy($this->qualifyRelatedColumn($group));
}
if (! is_null($column)) {
$subQuery->selectRaw($aggregate.'('.$subQuery->getQuery()->grammar->wrap($column).') as '.$subQuery->getQuery()->grammar->wrap($column));
$subQuery->selectRaw($aggregate.'('.$subQuery->getQuery()->grammar->wrap($subQuery->qualifyColumn($column)).') as '.$subQuery->getQuery()->grammar->wrap($column.'_aggregate'));
}
$this->addOneOfManySubQueryConstraints($subQuery, $groupBy, $column, $aggregate);
@@ -208,7 +217,7 @@ trait CanBeOneOfMany
$subQuery->applyBeforeQueryCallbacks();
$parent->joinSub($subQuery, $this->relationName, function ($join) use ($on) {
$join->on($this->qualifySubSelectColumn($on), '=', $this->qualifyRelatedColumn($on));
$join->on($this->qualifySubSelectColumn($on.'_aggregate'), '=', $this->qualifyRelatedColumn($on));
$this->addOneOfManyJoinSubQueryConstraints($join, $on);
});
+1 -1
View File
@@ -407,7 +407,7 @@ abstract class Relation
/**
* Define the morph map for polymorphic relations and require all morphed models to be explicitly mapped.
*
* @param array|null $map
* @param array $map
* @param bool $merge
* @return array
*/