Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryk committed Aug 10, 2021
1 parent 2f061b0 commit dfedad4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Services/Search/RepositorySearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,17 @@ public function prepareRelations(RestifyRequest $request, Builder | Relation $qu
{
$eager = $this->repository::collectRelated()
->forEager($request)
->inRequest($request)
->when($request->isIndexRequest(), fn (RelatedCollection $collection) => $collection->forIndex($request, $this->repository))
->when($request->isShowRequest(), fn (RelatedCollection $collection) => $collection->forShow($request, $this->repository))
->map(fn (EagerField $field) => $field->relation)
->merge(($this->repository)::withs())
->values()
->unique()
->all();

return $query->with($eager);
$query->with($eager);

return $query->with(($this->repository)::withs());
}

public function prepareSearchFields(RestifyRequest $request, $query, $extra = [])
Expand Down

0 comments on commit dfedad4

Please sign in to comment.