示例#1
0
 /**
  * @param callable $callback
  * @return array
  */
 public function process(callable $callback)
 {
     return Collection::process($this->all(), $callback);
 }
示例#2
0
文件: Menu.php 项目: hanif/stokq
 /**
  * Helper method to enable bind from input filter
  *
  * @param array|Type[] $types
  */
 public function setTypes($types)
 {
     if (is_array($types)) {
         Collection::apply($types, function (Type $type) {
             $rel = new MenuType();
             $rel->setType($type);
             $rel->setMenu($this);
             $this->getMenuTypes()->add($rel);
         });
     }
 }
示例#3
0
文件: StockItem.php 项目: hanif/stokq
 /**
  * Helper method to enable bind from input filter
  *
  * @param array|Category[] $categories
  */
 public function setCategories($categories)
 {
     if (is_array($categories)) {
         Collection::apply($categories, function (Category $category) {
             $rel = new StockCategory();
             $rel->setCategory($category);
             $rel->setStockItem($this);
             $this->getStockCategories()->add($rel);
         });
     }
 }