Hello Am trying to creating an e-commerce site, basically, there is a popup "Select Location" When the site is loaded.when a location is selected, then a location ID is Stored in session (location_id) through AJAX And I have to fetch the categories acc. to the Location ID and also categories stored in Category(term) Table. I have stored a location ID in category Table (A Category May Belongs to Many Locations So I serialize the value and stored in the DB)
Here is my Query for fetching all categories with some conditions.
$get_categories_data = Term::where(['type' => $cat_type, 'parent' => $cat_id, 'status' => 1])->get();
Now What I want is I have to fetch all categories acc to the session(location_id) value and also the location_id is serialized in the categories table