Skip to content

Commit

Permalink
Refactor docs
Browse files Browse the repository at this point in the history
  • Loading branch information
luilliarcec committed Oct 8, 2023
1 parent 6265f38 commit c23bc3d
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ return [

### Filters

| Filter | Class |
|--------|-------------------------------------------|
| Text | `TeamQ\QueryBuilder\Filters\TextFilter` |
| Number | `TeamQ\QueryBuilder\Filters\NumberFilter` |
| Date | `TeamQ\QueryBuilder\Filters\DateFilter` |
| Global | `TeamQ\QueryBuilder\Filters\GlobalFilter` |

You can use advanced filters that have support for multiple comparison operators.
The available comparison operators are located in `TeamQ\QueryBuilder\Enums\Comparators`

Expand Down Expand Up @@ -73,15 +80,6 @@ QueryBuilder::for(Book::class)
]);
```

##### Available filters:

| Filter | Class |
|--------|-------------------------------------------|
| Text | `TeamQ\QueryBuilder\Filters\TextFilter` |
| Number | `TeamQ\QueryBuilder\Filters\NumberFilter` |
| Date | `TeamQ\QueryBuilder\Filters\DateFilter` |
| Global | `TeamQ\QueryBuilder\Filters\GlobalFilter` |

#### Global Filter

The global filter implements general search functionality for the model and its relationships.
Expand All @@ -107,10 +105,15 @@ QueryBuilder::for(Book::class)

### Sorts

| Sort | Class |
|----------|-----------------------------------------|
| Relation | `TeamQ\QueryBuilder\Sorts\RelationSort` |
| Case | `TeamQ\QueryBuilder\Sorts\CaseSort` |

#### RelationSort

To sort by fields of related tables you must use `join`, there is no easy way to do it from eloquent,
so you can use `TeamQ\QueryBuilder\Sorts\RelationSort`, this class receives the type of `join` as a parameter.
so you can use `RelationSort`, this class receives the type of `join` as a parameter.

```php
use Spatie\QueryBuilder\AllowedFilter;
Expand All @@ -126,7 +129,7 @@ QueryBuilder::for(Book::class)
#### CaseSort

If you use enums or states, where each enum or state is represented by a number, you may want to sort by name
of that enum or state and not by the number, then you can use `TeamQ\QueryBuilder\Sorts\CaseSort`.
of that enum or state and not by the number, then you can use `CaseSort`.

You must pass an array `[$key => $value]`, which will be used to generate the sort.

Expand Down

0 comments on commit c23bc3d

Please sign in to comment.