samedi 8 septembre 2018

How to always show the records on the left with Laravel

In my project I have 2 basic tables with the following fields

Table 1

id - name - created_at - updated_at
1  - Name1 -  x        - y
2  - Name2 -  xx       - yy
3  - Name3 -  xxx       - yyy
4  - Name4 -  xxxx      - yyyy

Table 2

id - product_id- price_min - price_max  - created_at - updated_at
1  -  1        -   20      -  10       x       -  y
2  -  2        -   30      -  40       xx      -  yy

I want to obtain as result the following, all the products of my table 1 where the date of the updated_at field of my table2 is equal to one entered by parameter

The idea is that from the GUI the user can update the minimum and maximum prices of all the products in table 1 and save them in table 2, and if you already have a price to show it directly.

Result (where table2.updated_at = date passing parameter)

id - product_id- price_min - price_max  - table2.created_at - table2.updated_at
1  -  1        -   20      -  10       x       -  y
2  -  2        -   30      -  40       xx      -  yy
3  -  3        -   null    -  null    null      -  null    
4  -  4        -   null     -  null    null      -  null    



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2O1HK74
via IFTTT

Aucun commentaire:

Enregistrer un commentaire