sunel / eav

Entity–attribute–value model (EAV) for Laravel Artisan
https://sunel.github.io/eav/
143 stars 39 forks source link

Entity relashionship not working when called as property #8

Closed MikeMnD closed 6 years ago

MikeMnD commented 6 years ago

Docs says:

$product->baseEntity;

But this returns error: $product->baseEntity(); - works ok but maybe it should return relationship and $product->baseEntity()->get()- should do the job same as $product->baseEntity;

sunel commented 6 years ago

@MikeMnD

The base Entity is loaded based on the entity code from the model.

https://github.com/sunel/eav/blob/8c1be4f8ee387eb9b8a856816c39b57f94562998/src/Model.php#L19-L23

So adding additional query is not the intended scope.

This is the correct call.

$product->baseEntity();

Will update the doc.

sunel commented 6 years ago

Doc updated