As per the comments, I've reworked this question I'm new to Laravel 5 and MVC in general, so my question is aimed more at the proper "MVC" way of doing this.
I've got a Model/table (Category/categories), that have name, slug, and id columns. This would be things like "Brand", "Size", "Color". I then need to have multiple values for each of these. For example, "Size" would have "Small", "Medium", and "Large".
I would create a table with columns something like: id, category_id, name/value to accomplish this, and then do a join on the categories
id
value.
In Laravel however, I could create a CategoryValue
model which would have a belongsTo()
for the Category
model, and vice versa. This seems like overkill for something that is simply setting/getting list values. Is this the correct Laravel/MVC way of doing it?
On that same note, my Item
Model will have to store its values for each Category
. I need to link the Item
to the Category
and the CategoryValue
. At this level, do I create two separate pivot tables? Or do I have one pivot table with three values, such that it would have item_id
, category_id
, categoryValue_id
? I don't want to create excess models and tables.