/** * Setup the required filters necessary for executing a role search request, based on the $input provided. * * @param $input * @return mixed */ public function fromInput(array $input = []) { $filterCollection = new SearchFilterCollection(); if (isset($input['keywords'])) { $filterCollection->add(KeywordFilter::fromKeywords($input['keywords'])); } $filterCollection->add(OrderFilter::byInput($input)); $roles = $this->roleRepository->getByFilters($filterCollection); return $roles; }
/** * Setup the required filters necessary for executing a role search request, based on the $input provided. * * @param array $input * @return mixed */ public function fromInput(array $input = []) { $filterCollection = new SearchFilterCollection(); $filterCollection->add(new IncludeFilter('owner', 'domains')); if (isset($input['keywords'])) { $filterCollection->add(KeywordFilter::fromKeywords($input['keywords'])); } $filterCollection->add(OrderFilter::byInput($input)); $accounts = $this->accountRepository->getByFilters($filterCollection); return $accounts; }
/** * Setup the required filters necessary for executing a role search request, based on the $input provided. * * @param $input * @return mixed */ public function fromInput(array $input = []) { $filterCollection = new SearchFilterCollection(); if (isset($input['keywords'])) { $filterCollection->add(KeywordFilter::fromKeywords($input['keywords'])); } $orderFilter = OrderFilter::byInput($input); $orderFilter->setDefaultField('users.id'); $filterCollection->add($orderFilter); // @TODO: Only apply this if the user cannot manage accounts (aka, not a tectician) $filterCollection->add(new UserAccountFilter()); $roles = $this->userRepository->getByFilters($filterCollection); return $roles; }
/** * @expectedException \Exception */ public function testInvalidSortDirection() { $filter = OrderFilter::byFieldAndDirection('field', 'invalid direction'); $filter->applyToEloquent($this->query); }