/** * @param callable $callback * @return array */ public function process(callable $callback) { return Collection::process($this->all(), $callback); }
/** * 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); }); } }
/** * 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); }); } }