private function getArticles()
{
$query = Article::orderBy($this->sort, $this->sortOrder);
if ($this->searchTerm != '') {
$query->where('blog_url', 'LIKE', '%' . $this->searchTerm . '%');
}
// $query->whereHas('categories', function($query) {
// $query->whereIn('category_id', [8]);
// });
$query->where('language', 'LIKE', '%' . $this->filterLanguage . '%');
$query->where('tld', 'LIKE', '%' . $this->filterTld . '%');
if ($this->priceFrom > 0 or $this->priceTo > 0) {
$query->whereBetween('price_sale', [$this->priceFrom, $this->priceTo]);
}
if ($this->trafficFrom > 0 or $this->trafficTo > 0) {
if($this->trafficTo == 200000) {
$this->trafficTo = 99999999;
}
$query->whereBetween('traffic', [$this->trafficFrom, $this->trafficTo]);
}
return $query->paginate(15);
}
Hey guys, i have a question, so this query runs perfectly fine and pretty fast, but if i run the query with the code which is currently
commented out, it is extremely slow, is there something i can do about this?