czim / laravel-filter Goto Github PK
View Code? Open in Web Editor NEWConfigurable and modular approach to query Filters for Laravel
License: MIT License
Configurable and modular approach to query Filters for Laravel
License: MIT License
The link is there, but some clean, clear-cut and helpful examples should be added for both normal Filters and CountableFilters.
stripos()
response of 0 for 'inner'
should also use 'join'
as joinType.
First of all let me start by saying, this is perhaps the best package I have used in terms of usability.
Secondly, I would like to apologize. I really am in a fix, and I dont know where to post this to get a response on.
I have created a simple Filter structure from the examples to learn how to use this. Now if you look at the structure in the attached file, you will see that there are two strategies "methods" and "materials".
When I pass in an array to materials (say [1,2]), it means that to return all products with material_id 1 or 2. Similarly in case of methods.
But if I pass both, say materials=1 and methods=2, the resulting query is an "AND" operation, that is show all products with material_id = 1 AND method_id = 2.
But I dont see any help as to perform an OR operation. I will paste the query below for reference.
Query which is fired now (notice the and)
select distinct * from products left join method_product on method_product.product_id = products.id left join material_product on material_product.product_id = products.id where method_product.method_id in (1, 2) and material_product.material_id in (3) order by price_per_metre asc limit 10 offset 0
Query which I would like to be fired
select distinct * from products left join method_product on method_product.product_id = products.id left join material_product on material_product.product_id = products.id where method_product.method_id in (1, 2) or material_product.material_id in (3) order by price_per_metre asc limit 10 offset 0
Now, I can fire raw sql queries to achieve this, but I dont want to. I would very much like to use this package instead. I hope there must be some way to do so. If there is, then can it be included in the examples section?
ProductFilter (copy).txt
Setting up a new Filter is still too much of a hassle and there's too much to figure out or remember.
There should be a generator to set up a simple Filter framework with comments and placeholders to get you started.
This should be done (separately) for
I'm making search form with 2 dependent inputs:
city
distance
If user choose city
and distance == null
- then search results will include only entities within the city
. If user choose city
+ distance
search should ignore city
strategy and execute only distance
strategy with city center coordinates as a start point for distance calculations.
I've tried to get $this->data->attributes
in city
strategy to check if distance value is not empty and go to next strategy, but it's protected property.
Am I doing it wrong and maybe this could be solved by rules?
Hello,
Is this package suitable for filtering (and counting) on multiple levels of categories, for example:
Where the third level categories (e.g. biographies) are connected to the products and to the second level categories using pivot tables (many-to-many).
Applying the filters to the query is not the issue, however, counting the products in each category level is making it rather complex. I'm handling these in the countParameter()
method as 3 different strategies, but the joins keep having conflicts with each other.
Does this sound familiar?
I hope you can point me in the right direction. Thanks in advance!
Deprecation Notice: Class Czim\Filter\ParameterFilters\IsEmpty located in ./vendor/czim/laravel-filter/src/ParameterFilters/Empty.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0.
am trying to upgrade my project to Laravel 8 and this package is not compatible.
Is there a possibility of an upgrade?
If filter countable has multi dimensional array in it:
$filterCounters->get('age_groups');
// OUTPUT
[
'14-25' => 1,
'26-30' => 5,
'31-40' => 14,
'41-50' => 10,
]
It could be accessed like: $filterCounters->get('age_groups')['14-25'];
But if there is no such key in array - template will return an exception, and there is a need to isset()
checks in template and they started to smell a lot.
It would be great to have laravel way syntax for the array data access:
$filterCounters->get('age_groups.14-25');
Or am I doing it wrong and each age range should be fetched separately? If so, there would be much more than 500 counters in current app :'(
Output result should be like this:
Are there any plans to update this package to support the recently released Laravel 10?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.