public function ofType($type)
    {
        $items = [];

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

        $this->items = $items;

        return $this;
    }
public function ofType($type)
    {
        $items = [];

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

        $this->items = $items;

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

@param string $type

@return Collection The collection
Creates new collection with only pages of the specified type