Closed joaopmmartins closed 5 years ago
use Eav\Model;
class Products extends Model
{
const ENTITY = 'product';
public function categories()
{
return $this->belongsToMany(Category::class, 'product_category', 'product_id', 'category_id');
}
}
$product = new Products();
# instance of Eav\Entity
$entity = $product->baseEntity();
$entity->load(['attributes'']);
# Collection of all Attributes to the enitity
$entity->attributes
thanks.
I am building a dynamic filter for products but need to create an array (to build the search form first) with all the (filterable) attributes from products belonging to a category. Can you point me in the right direction?
Product model: