Skip to content

Commit

Permalink
Support HasOneDeep relationships from third-party packages
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Jun 20, 2023
1 parent b39e427 commit 018dfa2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/HasOneDeep.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ public function initRelation(array $models, $relation)
*/
public function match(array $models, Collection $results, $relation)
{
if ($this->customEagerMatchingCallbacks) {
foreach ($this->customEagerMatchingCallbacks as $callback) {
$models = $callback($models, $results, $relation, 'one');
}

return $models;
}

$dictionary = $this->buildDictionary($results);

foreach ($models as $model) {
Expand Down

0 comments on commit 018dfa2

Please sign in to comment.