示例#1
0
 /**
  * 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;
 }
示例#2
0
 /**
  * Whether a offset exists
  * @link  http://php.net/manual/en/arrayaccess.offsetexists.php
  *
  * @param mixed $offset <p>
  *                      An offset to check for.
  *                      </p>
  *
  * @return boolean true on success or false on failure.
  * </p>
  * <p>
  * The return value will be casted to boolean if non-boolean was returned.
  * @since 5.0.0
  */
 public function offsetExists($offset)
 {
     return $this->items->has($offset);
 }