1: <?php
2:
3: /**
4: * Deep
5: *
6: * @package rsanchez\Deep
7: * @author Rob Sanchez <info@robsanchez.com>
8: */
9:
10: namespace rsanchez\Deep\Collection;
11:
12: use rsanchez\Deep\Collection\FilterableTrait;
13: use rsanchez\Deep\Collection\FilterableInterface;
14: use Illuminate\Database\Eloquent\Collection;
15:
16: /**
17: * Collection of \rsanchez\Deep\Model\Category
18: */
19: class CategoryCollection extends Collection implements FilterableInterface
20: {
21: use FilterableTrait;
22:
23: /**
24: * Filter by cat_id attribute
25: *
26: * @param string $filter pipe-delimited list of cat_ids, optionaly prefixed by not
27: * @return \rsanchez\Deep\Collection\CategoryCollection
28: */
29: public function filterByShow($filter)
30: {
31: return $this->filterByAttributeInString('cat_id', $filter);
32: }
33:
34: /**
35: * Filter by group_id attribute
36: *
37: * @param string $filter pipe-delimited list of group_ids, optionaly prefixed by not
38: * @return \rsanchez\Deep\Collection\CategoryCollection
39: */
40: public function filterByShowGroup($filter)
41: {
42: return $this->filterByAttributeInString('group_id', $filter);
43: }
44: }
45: