Thursday, March 9, 2017

Faceted Navigation | PHP Laravel

I've the following DB structure:

Table: A
--|----|-----------|-------------|-------------|--
  | id | title     | category_id | location_id |
--|----|-----------|-------------|-------------|--
    1    Title 1     1             1
    2    Title 2     1             2
    3    Title 3     2             1
    4    Title 4     3             1

Table: B
--|----|-----------|--
  | id | category  | 
--|----|-----------|--
    1    Vehicles     
    2    Electronics     
    3    Books     
    4    Fashion     

Table: C
--|----|-----------|--
  | id | location  | 
--|----|-----------|--
    1    New York     
    2    Chicago     
    3    Los Angeles     
    4    London     

Let's say I query the table A with title like '%title%'and display the search results. Now, I want to build a faceted navigation on my search results page, giving users an option to filter records by category and location. Also, when I build the faceted navigation I want to display the count of records against each facet (category, location).

Does anyone know if there's an easy way to do this in PHP Laravel?

Thanks!



via Rishab

Advertisement