2
I have the following tables listed below
Products
- id
- product
- value
- validity
Consultation
- id
- user_id
Consults_products
- id
- query
- product
Whenever a user performs a query, the history is saved in the table consultas
and the products referred to in the table consultas_produtos
through the relationship.
How can I build a SQL
that when listing the products according to the query parameters, return only the products that were never consulted by the user?
You got the appointment you’re doing???
– novic
$products = Product::Where('value', '>=', $value)->get(); This will return all products that have the value greater than specified. I need to return only products that have never been queried by the user by checking the history through the association.
– Max Porcento
What is the? version of your Laravel? This information is important.
– novic
My version of Laravel is 5.6
– Max Porcento