public function visible()
    {
        $visible = [];

        foreach ($this->items as $path => $slug) {
            $page = $this->pages->get($path);
            if ($page !== null && $page->visible()) {
                $visible[$path] = $slug;
            }
        }
        $this->items = $visible;

        return $this;
    }
public function visible()
    {
        $visible = [];

        foreach ($this->items as $path => $slug) {
            $page = $this->pages->get($path);
            if ($page !== null && $page->visible()) {
                $visible[$path] = $slug;
            }
        }
        $this->items = $visible;

        return $this;
    }
public function visible ( ) { $ visible = [ ] ; foreach ( $ this -> items as $ path => $ slug ) { $ page = $ this -> pages -> get ( $ path ) ; if ( $ page !== null && $ page -> visible ( ) ) { $ visible [ $ path ] = $ slug ; } } $ this -> items = $ visible ; return $ this ; }
Creates new collection with only visible pages

@return Collection The collection with only visible pages
Creates new collection with only visible pages