Answer the question
In order to leave comments, you need to log in
How to get value for attribute properties in Laravel?
Good afternoon, I have a problem. Now I am making a product catalog, the database structure is as follows:
1. product - products
2. product_attribute - relationship between product and attribute_value
3. attribute_value - attribute properties
4. attribute - name of attributes
In the product model itself, the relationship with attribute properties (3. attribute_value)
public function attribute()
{
return $this->hasMany('App\Models\ProductAttribute');
}
Answer the question
In order to leave comments, you need to log in
You have a crooked connection. There should be three tables:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question