@php $categories->loadMissing(['slugable', 'activeChildren:id,name,parent_id', 'activeChildren.slugable']); if (!empty($categoriesRequest)) { $categories = $categories->whereIn('id', $categoriesRequest); } @endphp