protected function getFilterModifierInstance($query, $data, $config = null)
 {
     if (!$config) {
         $config = new \Johnrich85\EloquentQueryModifier\InputConfig();
         $config->setFilterableFields($query);
     }
     return new \Johnrich85\EloquentQueryModifier\Modifiers\PagingModifier($data, $query, $config);
 }
 protected function getSearchModifierInstance($query, $data, $config = null, $searchMode = 'column_limited')
 {
     if (!$config) {
         $config = new \Johnrich85\EloquentQueryModifier\InputConfig();
         $config->setFilterableFields($query);
     }
     $config->setSearchMode($searchMode);
     return new \Johnrich85\EloquentQueryModifier\Modifiers\SearchModifier($data, $query, $config);
 }
 public function test_all_columns_returned()
 {
     $model = new Category();
     $config = new InputConfig();
     $config->setFilterableFields($model->query());
     $columns = $config->getFilterableFields();
     $this->assertEquals(4, count($columns));
     $this->assertContains('id', $columns);
     $this->assertContains('name', $columns);
     $this->assertContains('created_at', $columns);
     $this->assertContains('updated_at', $columns);
 }
 /**
  * Retrieves the fields for a model &
  * assigns to the config.
  *
  * @param $builder
  */
 protected function setConfigFilterableFields(\Illuminate\Database\Eloquent\Builder $builder)
 {
     $this->config->setFilterableFields($builder);
 }
 protected function _getInstance($query, $fields = [], $config = null)
 {
     $this->data = $fields;
     if (!$config) {
         $config = new \Johnrich85\EloquentQueryModifier\InputConfig();
         $config->setFilterableFields($query);
     }
     return new FieldSelectionModifier($this->data, $query, $config);
 }
 protected function getFilterModifierInstance($query, $data, $config = null, $type = 'and')
 {
     if (!$config) {
         $config = new \Johnrich85\EloquentQueryModifier\InputConfig();
         $config->setFilterableFields($query);
     }
     if ($type == 'or') {
         $config->setFilterType('orWhere');
     }
     return new FilterModifier($data, $query, $config);
 }