5

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;

    // ...
}
Jarek Tkaczyk
  • 78,987
  • 25
  • 159
  • 157
AndrewMcLagan
  • 13,459
  • 23
  • 91
  • 158

1 Answers1

1

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.

lukasgeiter
  • 147,337
  • 26
  • 332
  • 270