I have table with records. In table i have column 'payment_date', and it's integer with unix timestamp. I need to select records from the database that are in the time interval of two days for each year and each month..
For example - I need all records from 1 to 15. This means that the result should contain entries for each year and each month from the 1st to the 15th:
from 2022-01-01 - to 2022-01-15
from 2022-02-01 - to 2022-02-15
//////////////////////
from 2023-07-01 - to 2023-07-15 etc.
$query->whereRaw('DAY(FROM_UNIXTIME(payment_date)) BETWEEN ' . $from . ' AND ' . $to);