I second this. Posted a related question:
https://laracasts.com/discuss/channels/laravel/laravel-scout-eager-loading-relationships
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have the following Eloquent scope:
return $query->where('title', 'like', '%' . $title . '%')->orWhereHas('alternatives', function($query) use ($title) {
return $query->where('title', 'like', '%' . $title . '%');
});
^ this scope will be called in controller like this:
return $this->item->findByTitle($title)->with('latestEpisode')->withCount('episodes')->get();
Is there a way to make this happens in Laravel Scout? I have the follwing:
return $this->item->search($title)->get()->load('latestEpisode');
^ few problems here: There isn't a method for withCount for Scout. The second problem is, how do i query the alternatives relation as above in my normal Eloquent scope?
Please or to participate in this conversation.