Skip to content

Commit

Permalink
Merge pull request #24 from pinkary-project/fix/eager-loading
Browse files Browse the repository at this point in the history
fix: removes duplication of queries
  • Loading branch information
nunomaduro authored Mar 21, 2024
2 parents 79808b7 + 0e79b7d commit d9b14be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Livewire/Links/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function render(): View
return view('livewire.links.index', [
'user' => $user,
'questionsReceivedCount' => $user->questionsReceived()->where('answer', '!=', null)->count(),
'links' => $user->links()->get()->sortBy(function (Link $link) use ($sort): int {
'links' => $user->links->sortBy(function (Link $link) use ($sort): int {
if (($index = array_search($link->id, $sort)) === false) {
return 1_000_000 + $link->id;
}
Expand Down

0 comments on commit d9b14be

Please sign in to comment.