protected function filterElements(Collection $collection, AdminMenu $parent = null)
    {
        $children = $collection->filter(function (AdminMenu $menuItem) use ($parent) {
            return $menuItem->getParent() === $parent;
        });
        
        return $children;
    }
protected function filterElements(Collection $collection, AdminMenu $parent = null)
    {
        $children = $collection->filter(function (AdminMenu $menuItem) use ($parent) {
            return $menuItem->getParent() === $parent;
        });
        
        return $children;
    }
protected function filterElements ( Collection $ collection , AdminMenu $ parent = null ) { $ children = $ collection -> filter ( function ( AdminMenu $ menuItem ) use ( $ parent ) { return $ menuItem -> getParent ( ) === $ parent ; } ) ; return $ children ; }
Filters the collection and returns only children elements for given parent element

@param Collection     $collection
@param AdminMenu|null $parent

@return Collection
Filters the collection and returns only children elements for given parent element