Skip to content

Commit

Permalink
Merge pull request #280 from P3D-Legacy/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dsbilling authored Jun 8, 2023
2 parents 6894349 + 4ca236c commit 01f7381
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Http/Livewire/Resource/ResourceList.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public function render()
if (request()->is('resource/category/*')) {
$perPage = 15; // Default for pagination
$filtered = Resource::orderBy('created_at', 'desc')->get()->filter(function ($resource) {
// If the category has one or more children, we want these as well
if (Category::where('slug', request()->segment(3))->first()->children()->count() > 0) {
return $resource->hasCategory(Category::where('slug', request()->segment(3))->first()) || $resource->hasCategory(Category::where('slug', request()->segment(3))->first()->children()->get());
}

return $resource->hasCategory(Category::where('slug', request()->segment(3))->first());
});
$resources = new LengthAwarePaginator(
Expand Down

0 comments on commit 01f7381

Please sign in to comment.