Product relates many to many to a ProductCategory called ProductCategories .
If we want to filter products by category, we would name the following:
$Product.filter('ProductCategories.ID', 5)
I would recommend writing this filter to a function in the controller. Something like that:
public function getFilteredProducts() { return Product::get()->filter('ProductCategories.Title', 'my-filter'); }
3dgoo
source share