let's test live

This commit is contained in:
Maik Müller 2021-09-19 21:32:45 +02:00
parent 2f0096cab2
commit ac2ecfac48
3 changed files with 64 additions and 1 deletions

View File

@ -12,4 +12,9 @@ return [
'log_channel' => 'default',
// Types
// Search
];

57
config/types.md Normal file
View File

@ -0,0 +1,57 @@
# Regex tmpl
([\w_-]*)\[([\w]*)\]=([\w_-]*)
# Search #
The search filter supports exact, partial, start, end, and word_start matching strategies:
partial strategy uses LIKE %text% to search for fields that contain text.
start strategy uses LIKE text% to search for fields that start with text.
end strategy uses LIKE %text to search for fields that end with text.
word_start strategy uses LIKE text% OR LIKE % text% to search for fields that contain words starting with text.
Syntax: ?property[]=foo&property[]=bar
optional brackets!
([\w_-]*)(\[(i?exact|i?partial|i?start|i?end|i?word_start)?\])?=([\w_\-\d]*) /gm
# Date Filter #
The date filter allows to filter a collection by date intervals.
Syntax: ?property[<after|before|strictly_after|strictly_before>]=value
The value can take any date format supported by the \DateTime constructor.
The after and before filters will filter including the value whereas strictly_after and strictly_before will
filter excluding the value.
# Boolean Fitler #
The boolean filter allows you to search on boolean fields and values.
Syntax: ?property=<true|false|1|0>
# Numeric Filter #
The numeric filter allows you to search on numeric fields and values.
Syntax: ?property=<int|bigint|decimal...>
# Range Filter #
The range filter allows you to filter by a value lower than, greater than, lower than or equal, greater than or equal and between two values.
Syntax: ?property[<lt|gt|lte|gte|between>]=value
# Exists Filter
The exists filter allows you to select items based on a nullable field value. It will also check the emptiness of a collection association.
Syntax: ?exists[property]=<true|false|1|0>

View File

@ -21,11 +21,12 @@ trait ColumnMultiFilter
public function scopeMultiFilter(Builder $query): Builder
{
//Log::debug("Request: " . print_r(request()->all(), true));
if (request()->has('filter')) {
$filters = request()->get('filter');
$this->log('Filter found: ' . print_r($filters, true));
$this->log('Filter found: '.print_r($filters, true));
return $this->filterQueryBuilder($query, $filters);