Skip to content

Commit 561edc9

Browse files
authored
updated docs
1 parent 539f401 commit 561edc9

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

README.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ in your controller override the following params:
9999

100100
## Filtering
101101

102-
103-
104-
105-
106102
### stable option that will be removed once experimental stable
107103

108104
For the get command you can filter by using the following url patterns
@@ -146,28 +142,28 @@ Add to your allowedScopes and can then be called in url as `?ageNull=1` for wher
146142

147143

148144

149-
### Experimental v5 currently
145+
### Filtering
150146

151147
- use the url pattern `filters[column][operator]=value` eg `filters[age][>]=18&filters[title][contains]=testing`
152148

153149
| Seperator | Description | Example | Result |
154150
| --------- | ----------------------------------------------- | ---------------------- | ----------------------------------------- |
155151
| empty / _`=`_ / `is` / `equals` | Equals | ?filters[field]=hello / ?filters[field][is]=hello | select ... where field = 'hello' |
156-
| _`!=`_ / `!is` / `!equals` / `not_equals` | Not Equals | ?filter[field][!is]=hello | select ... where field != 'hello' |
157-
| _`>`_ / `greater_than` | Greater Than | ?filter[field][greater_than]=5 | select ... where field > 5 |
158-
| _`>=`_ / `greater_than_or_equal_to` / `greater_or_equal` / `gte` | Greater Or Equal to | ?filter[field][greater_or_equal]=5 | select ... where field >= 5 |
159-
| _`<`_ / `less_than` | Less Than | ?filter[field][<]=5 | select ... where field <> 5 |
160-
| _`<=`_ / `less_than_or_equal_to` / `less_or_equal` / `lte` | Less Or Equal to | ?filter[field][less_or_equal]=5 | select ... where field <= 5 |
161-
| _`~`_ / `contains` | Contains (LIKE with wildcard on both sides) | ?filter[field][contains]=hello | select ... where field like '%hello%' |
162-
| _`^`_ / `starts_with` | Starts with (LIKE with wildcard on end) | ?filter[field][starts_with]=hello | select ... where field like 'hello%' |
163-
| _`$`_ / `ends_with` | Ends with (LIKE with wildcard on start) | ?filter[field][ends_with]=hello | select ... where field like 'hello%' |
164-
| _`!~`_ / `!contains` / `not_contains` | Not Contains (LIKE with wildcard on both sides) | ?filter[field][!contains]=hello | select ... where field not like '%hello%' |
165-
| _`!^`_ / `!starts_with` / `not_starts_with` | Not Starts with (LIKE with wildcard on end) | ?filter[field][!^]=hello | select ... where field not like 'hello%' |
166-
| _`!$`_ / `!ends_with` / `not_ends_with` | Not Ends with (LIKE with wildcard on start) | ?filter[field][!$]=hello | select ... where field not like 'hello%' |
167-
| `in` | in | ?filter[field][in]=1,2,3 | select ... where field in(1,2,3) |
168-
| `not_in` / `!in` | NOT in | ?filter[field][in]=1,2,3 | select ... where field not in(1,2,3) |
169-
| `has` | has | ?filter[field][has] | select ... where exists(field join) |
170-
| `not_has` / `!has` | NOT has | ?filter[field][!has] | select ... where not exists (field join) |
152+
| _`!=`_ / `!is` / `!equals` / `not_equals` | Not Equals | ?filters[field][!is]=hello | select ... where field != 'hello' |
153+
| _`>`_ / `greater_than` | Greater Than | ?filters[field][greater_than]=5 | select ... where field > 5 |
154+
| _`>=`_ / `greater_than_or_equal_to` / `greater_or_equal` / `gte` | Greater Or Equal to | ?filters[field][greater_or_equal]=5 | select ... where field >= 5 |
155+
| _`<`_ / `less_than` | Less Than | ?filters[field][<]=5 | select ... where field <> 5 |
156+
| _`<=`_ / `less_than_or_equal_to` / `less_or_equal` / `lte` | Less Or Equal to | ?filters[field][less_or_equal]=5 | select ... where field <= 5 |
157+
| _`~`_ / `contains` | Contains (LIKE with wildcard on both sides) | ?filters[field][contains]=hello | select ... where field like '%hello%' |
158+
| _`^`_ / `starts_with` | Starts with (LIKE with wildcard on end) | ?filters[field][starts_with]=hello | select ... where field like 'hello%' |
159+
| _`$`_ / `ends_with` | Ends with (LIKE with wildcard on start) | ?filters[field][ends_with]=hello | select ... where field like 'hello%' |
160+
| _`!~`_ / `!contains` / `not_contains` | Not Contains (LIKE with wildcard on both sides) | ?filters[field][!contains]=hello | select ... where field not like '%hello%' |
161+
| _`!^`_ / `!starts_with` / `not_starts_with` | Not Starts with (LIKE with wildcard on end) | ?filters[field][!^]=hello | select ... where field not like 'hello%' |
162+
| _`!$`_ / `!ends_with` / `not_ends_with` | Not Ends with (LIKE with wildcard on start) | ?filters[field][!$]=hello | select ... where field not like 'hello%' |
163+
| `in` | in | ?filters[field][in]=1,2,3 | select ... where field in(1,2,3) |
164+
| `not_in` / `!in` | NOT in | ?filters[field][in]=1,2,3 | select ... where field not in(1,2,3) |
165+
| `has` | has | ?filters[field][has] | select ... where exists(field join) |
166+
| `not_has` / `!has` | NOT has | ?filters[field][!has] | select ... where not exists (field join) |
171167

172168
* Null = `filters[age]=NULL` will generate `where age is null`
173169

@@ -386,6 +382,16 @@ you can override responses for each point by overriding the following protected
386382
- handleUpdateResponse
387383
- handleDestroyResponse
388384

385+
## Perforance Tips
386+
387+
### Cache Table column definitions
388+
-- introduced https://github.com/phpsa/laravel-api-controller/pull/118/files
389+
add the ability to cache the table definitions to reduce calls to fetch table columns, to enable either enable in the config file or set the `PHPSA_API_CACHE_TABLE_COLUMNS` variable to true.
390+
391+
### Raw Pagination gets
392+
393+
-- handleIndexAction will use full eloquent models, handleIndexActionRaw will bypass eloquent and use raw responses from the database.
394+
389395
## Security
390396

391397
If you discover any security related issues, please email

0 commit comments

Comments
 (0)