Skip to content

Commit

Permalink
Add keyword search to product families
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson committed Mar 18, 2021
1 parent 72a7399 commit aaaa441
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Core/Products/Actions/FetchProductFamilies.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function rules()
return [
'per_page' => 'numeric|max:200',
'paginate' => 'boolean',
'keywords' => 'nullable',
];
}

Expand All @@ -48,6 +49,10 @@ public function handle()
return $query->get();
}

if ($this->keywords) {
$query->where('name', 'LIKE', "%{$this->keywords}%");
}

return $query->withCount(
$this->resolveRelationCounts()
)->paginate($this->per_page ?? 50);
Expand Down

0 comments on commit aaaa441

Please sign in to comment.