mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-08 04:00:14 -05:00
optimize: whereIn and whereNotIn queries
This commit is contained in:
@@ -54,9 +54,9 @@ class SubtitleSearch extends Component
|
||||
return Subtitle::with(['user', 'torrent', 'language'])
|
||||
->when($this->search, fn ($query) => $query->where('title', 'like', '%'.$this->search.'%'))
|
||||
->when($this->categories, function ($query) {
|
||||
$torrents = Torrent::whereIn('category_id', $this->categories)->pluck('id');
|
||||
$torrents = Torrent::whereIntegerInRaw('category_id', $this->categories)->pluck('id');
|
||||
|
||||
return $query->whereIn('torrent_id', $torrents);
|
||||
return $query->whereIntegerInRaw('torrent_id', $torrents);
|
||||
})
|
||||
->when($this->language, fn ($query) => $query->where('language_id', '=', $this->language))
|
||||
->orderBy($this->sortField, $this->sortDirection)
|
||||
|
||||
Reference in New Issue
Block a user