Reputation: 13987
I have a Product model and a Attribute model.
Products have Attributes.
Problem is I cant use Attributes as a member of a Product class that extends eloquent as eloquent uses this already. Is there a way around this?
class Product extends Model
{
protected $attributes;
// ...
}
Upvotes: 5
Views: 1761
Reputation: 152880
You won't get around renaming your relation. e.g. productAttributes
.
The problem here is, that the attributes
property is used a lot by Eloquent and there is no way to change that by configuration or overriding a small piece of code. You would need to override a lot of classes to change the name to something else, which is definitely not worth it.
Upvotes: 1