I
I
Ivan Huk2020-08-11 19:54:05
ORM
Ivan Huk, 2020-08-11 19:54:05

How to make optimal query with laravel ORM?

there are three tables: products and options and product_options

In products fields:

  • id
  • name
  • picture_id


In options fields:
  • id
  • name


In product_options fields:
  • id
  • product_id
  • option_id


It is necessary to write such a query so that a filter is made on the products table , but the option_id fields of the associated product_options table

with Join are taken into account. :class)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2020-08-11
@vanyahuk7

https://laravel.com/docs/7.x/eloquent-relationship...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question