Example #1
0
 /**
  * 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;
 }
Example #2
0
 /**
  * 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;
 }