thank you @thewebartisan7
(I have some problem with package "laravel debugbar" I will try to fix it)
when I type this url:
localhost/site/public/products?filter[category][]=16&filter[category][]=12&filter[category][]=15
https://i.imgur.com/V9IkoQQ.png
query.log
[2020-10-02 20:47:31]
select column_name as `column_name` from information_schema.columns where table_schema = ? and table_name = ? [site, settings]
[2020-10-02 20:47:31]
select * from `settings` []
[2020-10-02 20:47:32]
select * from `attribute_values` []
[2020-10-02 20:47:32]
select * from `products` where exists (select * from `categories` inner join `product_categories` on `categories`.`id` = `product_categories`.`category_id` where `products`.`id` = `product_categories`.`product_id` and `category_id` in (?, ?, ?)) [16, 12, 15]
[2020-10-02 20:47:32]
select * from `categories` order by -name ASC []
[2020-10-02 20:47:32]
select * from `brands` order by -name ASC []
[2020-10-02 20:47:32]
select * from `attribute_values` where `attribute_id` = ? order by -value ASC [1]
[2020-10-02 20:47:32]
select * from `attribute_values` where `attribute_id` = ? order by -value ASC [2]
and when type this url:
localhost/site/public/products?filter[category]=16,12,15
https://i.imgur.com/IAxtgwp.png
query.log
[2020-10-02 20:49:23]
select column_name as `column_name` from information_schema.columns where table_schema = ? and table_name = ? [site, settings]
[2020-10-02 20:49:23]
select * from `settings` []
[2020-10-02 20:49:23]
select * from `attribute_values` []
[2020-10-02 20:49:23]
select * from `products` where exists (select * from `categories` inner join `product_categories` on `categories`.`id` = `product_categories`.`category_id` where `products`.`id` = `product_categories`.`product_id` and `category_id` in (?, ?, ?)) [16, 12, 15]
[2020-10-02 20:49:24]
select * from `categories` order by -name ASC []
[2020-10-02 20:49:24]
select * from `brands` order by -name ASC []
[2020-10-02 20:49:24]
select * from `attribute_values` where `attribute_id` = ? order by -value ASC [1]
[2020-10-02 20:49:24]
select * from `attribute_values` where `attribute_id` = ? order by -value ASC [2]
and when i type this for brand :
http://localhost/site/public/products?filter[brand]=1,6,9
query.log
[2020-10-02 20:51:11]
select * from `products` where `brand_id` in (?, ?, ?) [1, 6, 9]
and the same result for this
http://localhost/site/public/products?filter[brand]=1,6,9
but when I type this:
http://localhost/site/public/products?filter%5Bbrand%5D=1&filter%5Bbrand%5D=6&filter%5Bbrand%5D=9
https://i.imgur.com/pTlEdQd.png
query.log
[2020-10-02 20:56:03]
select * from `products` where `brand_id` = ? [9]
and when I type this
http://localhost/site/public/products?filter%5Bcategory%5D=16&filter%5Bcategory%5D=12&filter%5Bcategory%5D=15
query.log
[2020-10-02 21:06:21]
select * from `products` where exists (select * from `categories` inner join `product_categories` on `categories`.`id` = `product_categories`.`category_id` where `products`.`id` = `product_categories`.`product_id` and `category_id` = ?) [15]
ok I tell you that when I tried your second way It works
when check category with id=12,15,16 with checkbox
query.log:
[2020-10-02 21:18:35]
select column_name as `column_name` from information_schema.columns where table_schema = ? and table_name = ? [site, settings]
[2020-10-02 21:18:35]
select * from `settings` []
[2020-10-02 21:18:35]
select * from `attribute_values` []
[2020-10-02 21:18:36]
select * from `products` where exists (select * from `categories` inner join `product_categories` on `categories`.`id` = `product_categories`.`category_id` where `products`.`id` = `product_categories`.`product_id` and `category_id` in (?, ?, ?)) [12, 15, 16]
[2020-10-02 21:18:36]
select * from `categories` order by -name ASC []
[2020-10-02 21:18:36]
select * from `brands` order by -name ASC []
[2020-10-02 21:18:36]
select * from `attribute_values` where `attribute_id` = ? order by -value ASC [1]
[2020-10-02 21:18:36]
select * from `attribute_values` where `attribute_id` = ? order by -value ASC [2]
[2020-10-02 21:18:36]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [1]
[2020-10-02 21:18:36]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [2]
[2020-10-02 21:18:36]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [4]
[2020-10-02 21:18:36]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [7]
[2020-10-02 21:18:36]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [8]
[2020-10-02 21:18:36]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [10]
[2020-10-02 21:18:36]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [11]
[2020-10-02 21:18:36]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [12]
[2020-10-02 21:18:36]
select * from `categories` order by -name ASC []
and this when I type this
http://localhost/site/public/products?filter[category][]=16&filter[category][]=12&filter[category][]=15
query.log:
[2020-10-02 21:21:20]
select column_name as `column_name` from information_schema.columns where table_schema = ? and table_name = ? [site, settings]
[2020-10-02 21:21:21]
select * from `settings` []
[2020-10-02 21:21:21]
select * from `attribute_values` []
[2020-10-02 21:21:21]
select * from `products` where exists (select * from `categories` inner join `product_categories` on `categories`.`id` = `product_categories`.`category_id` where `products`.`id` = `product_categories`.`product_id` and `category_id` in (?, ?, ?)) [16, 12, 15]
[2020-10-02 21:21:22]
select * from `categories` order by -name ASC []
[2020-10-02 21:21:22]
select * from `brands` order by -name ASC []
[2020-10-02 21:21:22]
select * from `attribute_values` where `attribute_id` = ? order by -value ASC [1]
[2020-10-02 21:21:22]
select * from `attribute_values` where `attribute_id` = ? order by -value ASC [2]
[2020-10-02 21:21:22]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [1]
[2020-10-02 21:21:22]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [2]
[2020-10-02 21:21:22]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [4]
[2020-10-02 21:21:22]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [7]
[2020-10-02 21:21:22]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [8]
[2020-10-02 21:21:22]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [10]
[2020-10-02 21:21:22]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [11]
[2020-10-02 21:21:22]
select * from `product_images` where `product_images`.`product_id` = ? and `product_images`.`product_id` is not null [12]
[2020-10-02 21:21:22]
select * from `categories` order by -name ASC []