Thanks for the reply @jlrdw
While I haven't had an issue now, I might do in the future. Such as my example with using the clean() and dirty() Eloquent methods.
I don't think the fact that I haven't noticed an error yet is enough to say there never will be one.
I just did a little test and doing this in a controller is fine:
return $this->changes->count();
Because changes is an Eloquent collection coming from the changes() method.
But this inside the model:
public function testChanges()
{
return $this->changes->count();
}
Throws an error "Call to a member function count() on array"
Because it's happening within the class itself it has access to the protected property $changes on the HasAttributes trait which is an array.
It seems strange to me that I can't find anyone else who has encountered this.
It seems there should probably be warnings thrown if your attribute clashes with a protected property.