public static function filterCategoriesByParentSlug($query, $slug) {
        $obj = \Delatbabel\NestedCategories\Models\Category::where('slug', $slug)->first();
        if ($obj) {
            $query->where('parent_id', $obj->id);
        } else {
            $query->where('slug', $slug);
        }
    }
public static function filterCategoriesByParentSlug($query, $slug) {
        $obj = \Delatbabel\NestedCategories\Models\Category::where('slug', $slug)->first();
        if ($obj) {
            $query->where('parent_id', $obj->id);
        } else {
            $query->where('slug', $slug);
        }
    }
public static function filterCategoriesByParentSlug ( $ query , $ slug ) { $ obj = \ Delatbabel \ NestedCategories \ Models \ Category :: where ( 'slug' , $ slug ) -> first ( ) ; if ( $ obj ) { $ query -> where ( 'parent_id' , $ obj -> id ) ; } else { $ query -> where ( 'slug' , $ slug ) ; } }
Returns a query to find subcategories of a parent category by the slug.

@param Builder $query
@param string $slug
@return Builder
Returns a query to find subcategories of a parent category by the slug .