You have 3 options depending on your needs and project size.
I. Keep it all in 'products' table:
Just add specifications field into products table if the quantity on fields in not so high. It is easier for acessing and filtering but harder for extenion and modification.
Access:
$product->brand;
Filtering:
Product::where('brand', 'Asus')->get();
II. Use one-to-one relation with 'product_specifications' table:
Table 'product_specifications' with all those fields (id, product_id, brand, model, chipset_manufacturer etc). Write a relation method in Product class to access specification:
public function specification() {
return hasOne(ProductSpecification::class);
}
Acess:
$product->specification->brand;
Filtering:
$productsWithAsusBrand= Product::whereHas('specification', function($query) {
$query->where('brand', 'Asus');
})->get();
III. Use many-to-many relation with 'specification_types':
Tables:
specification_types(id, name)
product_specifications(id, product_id, type_id, value)
product(id, name, etc)
So your specification_types will store all the specifications type like rows:
id name
-----------
1 Brand
2 Model
...
And your pivot product_specifications will store all specifications values:
id product_id type_id value
----------------------------------
1 1 1 Asus
In your Product model:
public function specificationTypes() {
return belongsToMany(SpecificationType::class, 'product_specifications');
}
In your SpecificationType model:
public function products() {
return belongsToMany(Product::class, 'product_specifications');
}
Acess:
foreach ($product->specificationTypes as $type) {
var_dump($type->name . ': ' . $type->pivot->value)
}