Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mariam528's avatar

multiple dynamic filters in laravel

hello i have a table named "filters" that has "has many" relationship with the "products" table. filters table contain three column.one for filter name, the other for filter value, and third containing pro_id. i want to show filters of the products that are being displayed in a page. like in this formate

filter1
value1 (count)
value2 (count)

filter2
value1 (count)
value2 (count)

point: these filters are dynamic. they won't be the same for every product category hope someone got my point. can anybody guide me on how I can achieve this? i would really appreciate any help. thanks

0 likes
2 replies
awsqed's avatar

Is there an ID field (primary key) in the filters table or the field filter_name is the primary key?

Please or to participate in this conversation.