/**
  * Return only children of the provided item.
  *
  * @param LinkInterface $parent
  * @return LinkCollection
  */
 public function children(LinkInterface $parent)
 {
     $children = [];
     /* @var LinkInterface $item */
     foreach ($this->items as $item) {
         if ($item->getParentId() == $parent->getId()) {
             $children[] = $item;
         }
     }
     return new static($children);
 }
예제 #2
0
 /**
  * Return the edit link.
  *
  * @return string
  */
 public function editLink()
 {
     return app('html')->link(implode('/', array_filter(['admin', $this->object->getStreamNamespace(), $this->object->getStreamSlug(), $this->object->getMenuSlug(), 'edit', $this->object->getId()])), $this->object->getTitle());
 }