You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More fixes 🆙
This commit is contained in:
@@ -8,12 +8,18 @@ use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class RareValueCategoriesService
|
||||
{
|
||||
/**
|
||||
* @return Collection<int, WebsiteRareValueCategory>
|
||||
*/
|
||||
public function fetchAllCategories(): Collection
|
||||
{
|
||||
return WebsiteRareValueCategory::all();
|
||||
}
|
||||
|
||||
public function fetchCategoriesByPriority(): Builder|Collection
|
||||
/**
|
||||
* @return Collection<int, WebsiteRareValueCategory>
|
||||
*/
|
||||
public function fetchCategoriesByPriority(): Collection
|
||||
{
|
||||
return WebsiteRareValueCategory::orderBy('priority')->with('furniture')->get();
|
||||
}
|
||||
@@ -23,12 +29,16 @@ class RareValueCategoriesService
|
||||
return WebsiteRareValueCategory::orderBy('priority')->whereId($id)->with('furniture')->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, WebsiteRareValueCategory>
|
||||
*/
|
||||
public function searchCategories(string $searchTerm): Collection
|
||||
{
|
||||
return WebsiteRareValueCategory::orderBy('priority')->whereHas('furniture', function ($query) use ($searchTerm): void {
|
||||
$query->where('name', 'like', '%' . $searchTerm . '%');
|
||||
})
|
||||
->with(['furniture' => function ($query) use ($searchTerm): void {
|
||||
/** @var Builder $query */
|
||||
$query->where('name', 'like', '%' . $searchTerm . '%');
|
||||
}])
|
||||
->get();
|
||||
|
||||
Reference in New Issue
Block a user