示例#1
0
 public function testWithArrayOfFieldNames()
 {
     $mockQuery = m::mock('query');
     $mockQuery->shouldReceive('where')->with('title', 'LIKE', '%keywords%')->once()->andReturn($mockQuery);
     $mockQuery->shouldReceive('where')->with('name', 'LIKE', '%keywords%')->once()->andReturn($mockQuery);
     $filter = KeywordFilter::fromKeywords('keywords', ['title', 'name']);
     $filter->applyToEloquent($mockQuery);
 }
示例#2
0
 /**
  * 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;
 }
示例#3
0
 /**
  * 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;
 }
示例#4
0
 /**
  * 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;
 }