rinvex / laravel-attributes

⚠️ [ABANDONED] Rinvex Attributable is a robust, intelligent, and integrated Entity-Attribute-Value model (EAV) implementation for Laravel Eloquent, with powerful underlying for managing entity attributes implicitly as relations with ease. It utilizes the power of Laravel Eloquent, with smooth and seamless integration.
MIT License
434 stars 104 forks source link

How to store money values? #39

Closed mepoohsta closed 6 years ago

mepoohsta commented 6 years ago

Something like this

Value + currency

image

IsraelOrtuno commented 6 years ago

As of now I think you need two attributes for that:

How would you do with a normal database schema? Probably two columns, right?

mepoohsta commented 6 years ago

Yea, you are right. Thank you.

mepoohsta commented 6 years ago

But how to store multiple money-currency values in one model? If I store multiple money values, how to bind one money to currency and another money to another currency? Maybe you can help.

IsraelOrtuno commented 6 years ago

Create your migration for storing that value type: https://github.com/rinvex/attributes/blob/master/database/migrations/2017_01_19_040622_create_attribute_integer_values_table.php

Create the model for that value: https://github.com/rinvex/attributes/blob/master/src/Models/Type/Integer.php

Add it to map: https://github.com/rinvex/attributes/blob/master/src/Providers/AttributesServiceProvider.php#L57-L63

This should work :)