abbasudo / laravel-purity

An elegant way to filter and sort queries in Laravel
https://abbasudo.github.io/laravel-purity/?utm_source=github&utm_medium=about
MIT License
444 stars 42 forks source link

$and condition and paginate() #21

Open romatexdev opened 10 months ago

romatexdev commented 10 months ago

Hi! Thank you for this wonderful package! It made it easier to create filters!!! But there are points that are not specified in the documentation.

  1. How do I use a filter inside my livewire component with the condition $and? I have an array of identifiers by which to filter with the condition that they are all present in the output. With the use of $eq, $contains, everything is clear, but here I can't figure out how to use it. I'll clarify. I don't use the query string, everything happens inside the livewire component.

  2. How to apply pagination after filtering and sorting? If I now apply ->paginate(), then it causes an error.

abbasudo commented 9 months ago

hello @romatexdev please provide me with more details and the error message that you are getting.

carlos-talavera commented 3 months ago

Hi @romatexdev

I don't know how you're doing it, but I used paginate() with no problems just like this: Model::filter()->paginate()

I don't use sorting on my project, but it works too