/** * Add an item from array. * * @param array $array * * @return self */ public function add(array $array) { $item = Item::makeFromArray($array, $this->user); if ($item->allowed()) { $this->items->push($item); } return $this; }
/** * Add children to the parent. * * @param array $children * * @return self */ private function addChildren(array $children) { foreach ($children as $child) { $item = self::makeFromArray($child, $this->user); if ($item->allowed()) { $this->children->push($item); } } return $this; }