mardi 26 mars 2019

Laravel/PHP - First In - First Out

In a stock management software based on Laravel, What is the best way to save product price and quantity in the database which later can efficiently retrieve in the First In - First Out (FIFO) order.

| ID    | Date        | Quantity | Rate  | Item        |
|-------|-------------|----------| ------|-------------|
|   1   | 01-Jan-2019 | 10       |  100  | Product 01  |
|   2   | 01-Feb-2019 | 12       |  110  | Product 01  |
|   3   | 01-Mar-2019 | 10       |  120  | Product 01  |
--------------------------------------------------------
|   4   | 01-Jan-2019 | 10       |  50   | Product 02  |
|   5   | 01-Feb-2019 | 12       |  40   | Product 02  |
|   6   | 01-Mar-2019 | 15       |  30   | Product 02  |

I'm stuck on retrieve(Calculate the total)/decrease stock using Laravel Eloquent ORM. Can anyone point me to a good tutorial or let me know the proper way to achieve these on Laravel? Or should I change the database structure to get the maximum efficacy?



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

Aucun commentaire:

Enregistrer un commentaire