/**
  * Add a new Item (or edit an existing item) to the Group
  *
  * @param string   $name
  * @param callable $callback
  *
  * @return Item
  */
 public function item($name, Closure $callback = null)
 {
     if ($this->items->has($name)) {
         $item = $this->items->get($name);
     } else {
         $item = $this->container->make('Maatwebsite\\Sidebar\\Item');
         $item->name($name);
     }
     $this->call($callback, $item);
     $this->addItem($item);
     return $item;
 }
Exemple #2
0
 /**
  * Offset to retrieve
  * @link  http://php.net/manual/en/arrayaccess.offsetget.php
  *
  * @param mixed $offset <p>
  *                      The offset to retrieve.
  *                      </p>
  *
  * @return mixed Can return all value types.
  * @since 5.0.0
  */
 public function offsetGet($offset)
 {
     return $this->items->get($offset);
 }