I have table order related to warehouse with related to warehouse_delivery.
With following structure:
+--------------------------------------+ +-----------+
| Order | | Warehouse |
+----+--------------+------+-----------+ +----+------+
| id | warehouse_id | cost | send_date | | id | name |
+----+--------------+------+-----------+ +----+------+
+--------------------------------------------------------------------------+
| WarehouseDelivery |
+----+--------------+------------------------+-----------------------------+
| id | warehouse_id | domestic_delivery_time | international_delivery_time |
+----+--------------+------------------------+-----------------------------+
Delivery time is stored as days.
And now I would like to search by send_date to find Orders where send_date + domestic_delivery_time is today.
I don't have a idea how can I grab that domestic_delivery_time added to send_date.
Order::where('warehouse_id', $warehouseId)
->with(['product', 'warehouse.warehouseDelivery'])
->get();
How to write query?
Thank you.