Answer the question
In order to leave comments, you need to log in
How to create such a relationship in Eloquent?
Hello!
I would appreciate a recommendation on Laravel Eloquent.
Suppose an online store catalog is created, which has a Product model (product) and an Option model (product feature). There is a need to arbitrarily create different characteristics with different attributes (for example, different Option may have different units of measure, etc.). At the output, you need the ability to get the value of any option for any model:
$product = Product::find(1);
$product->option;
products (id,...)
options (id,...)
products_options(product_id,option_id,option_value)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question