Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BeginsWithStrict filter #821

Merged
merged 6 commits into from
Nov 28, 2022
Merged

Add BeginsWithStrict filter #821

merged 6 commits into from
Nov 28, 2022

Conversation

danilopinotti
Copy link
Contributor

@danilopinotti danilopinotti commented Oct 31, 2022

Introduction

The current "FiltersPartial" filter is very useful, but, it has some performance issues when we use it in a table with many data (see #820).

This PR introduces the "beginsWithStrict" filter, which may be used in situations described before.

In addition, this PR also allows us to extend the PartialFilter to change only the "where" clause applies (method getWhereRawParameters), making it possible implements other cases, like beginsWith, endsWith, endsWithStrict, etc.

Using

$users = QueryBuilder::for(User::with('media'))
    ->allowedFilters([
        AllowedFilter::beginsWithStrict('name'),
    ])
   // ...

TODO

  • Implements BeginsWithStrict
  • Cover with Tests

Related

Closes #820

@danilopinotti danilopinotti marked this pull request as draft October 31, 2022 17:29
@danilopinotti danilopinotti marked this pull request as ready for review November 1, 2022 16:07
@oceanapplications
Copy link

Merging this would make my day :)

@AlexVanderbist
Copy link
Member

Good addition, thanks!

@AlexVanderbist AlexVanderbist merged commit 4e08209 into spatie:main Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FiltersPartial index miss
3 participants