where('parent_id', 0); break; case 'all': break; default: break; } return $q; } public function cropType($cropType) { return $this->where('crop_type', $cropType); } public function category($categoryId) { return $this->where('category_id', $categoryId); } public function parent($parentId) { return $this->where('parent_id', $parentId); } public function name($name) { return $this->where('name', 'like', '%'.$name.'%'); } }