Giter Club home page Giter Club logo

laravel-filter's People

Contributors

antonkomarev avatar czim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

laravel-filter's Issues

Join using "OR"

@czim

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

Dependent strategies

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?

Filter & count on multiple levels of categories (many-to-many)

Hello,
Is this package suitable for filtering (and counting) on multiple levels of categories, for example:

  1. Books (100)
    1. Fiction (50)
    2. Non-fiction (50)
      1. Biographies (10)
      2. Study books (8)
      3. Etc.

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: psr-4 autoloading

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.

Laravel 8 upgrade support

am trying to upgrade my project to Laravel 8 and this package is not compatible.
Is there a possibility of an upgrade?

CountableFilters data array access

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:

selection_134

Laravel 10

Are there any plans to update this package to support the recently released Laravel 10?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.