Joe

but there’s an easier way to do that

r3v3rb

by getting the ID's it effectively removes the duplicate entries in multiple categories 😄

r3v3rb

Ah ha @Joe, but I needed DISTINCT to remove duplicates in the SubCategories 😉

Joe

no need to get their IDs and re-get the list from the DB

Joe

that’s a list of Products that are associated with any subcategory, that are approved for use, and are not bespoke

Joe
  1. return SubCategory::get()->relation('Products')->exclude(['Bespoke'=>1])->filter(['ApprovedForUse'=>1]);
Joe

although if all you’re trying to do is return products, you already have it without having to return IDs