diff --git a/config/column-multi-filter.php b/config/column-multi-filter.php index 82c7545..8b3d026 100644 --- a/config/column-multi-filter.php +++ b/config/column-multi-filter.php @@ -12,4 +12,9 @@ return [ 'log_channel' => 'default', + // Types + // Search + + + ]; diff --git a/config/types.md b/config/types.md new file mode 100644 index 0000000..bb0b9bb --- /dev/null +++ b/config/types.md @@ -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[]=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= + +# Numeric Filter # + +The numeric filter allows you to search on numeric fields and values. + +Syntax: ?property= + +# 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[]=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]= + + diff --git a/src/ColumnMultiFilter.php b/src/ColumnMultiFilter.php index 70b087c..a3b990a 100644 --- a/src/ColumnMultiFilter.php +++ b/src/ColumnMultiFilter.php @@ -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);