Stackoverflow!
I'm usign Laravel. The question is about relations in Eloquent.
Item might have 1 or more than 1 types.
Item.php:
public function types()
{
return $this->hasMany('App\Type');
}
Type.php:
public function items()
{
return $this->belongsToMany('App\Item');
}
Item table:
id
name
Type table:
id
name
The question
I have 4 types. Item №1 has 2 types, Item №2 has 1 type. How should I store item types in database?