There is a table TOS_MES, it has the fields MONTH_CH and YEAR_CH, in the template there are 2 input fields with type = 'month' (date from and to). How to display all data from this table on the dates that the user specified in these fields? I tried to do it through whereBetween, but it does not work correctly, namely if I, for example, choose the 6th month and the 2017th year and until the 11th month of the 2018th, it will only output data from 6-11 months. I tried to bring this data into Unix-time, but in this case nothing is output at all. Date in Yn format:
$newDateFrom = explode("-", $data['dateFrom']); // Дата от $newDateTo = explode("-", $data['dateTo']); // Дата до $dataForTable = DB::table('CAT_STATION') ->join('CAT_OBL', 'CAT_STATION.OBL_ID', '=', 'CAT_OBL.OBL_ID') ->join('TOS_MES', 'CAT_STATION.IND_ST', '=', 'TOS_MES.IND_ST') ->select('CAT_OBL.NAME_OBL', 'CAT_STATION.NAME_ST', 'TOS_MES.IND_ST', 'TOS_MES.YEAR_CH', 'TOS_MES.MONTH_CH', 'TOS_MES.T', 'TOS_MES.OS') ->orderBy('CAT_STATION.OBL_ID', 'asc') ->orderBy('CAT_STATION.IND_ST') ->whereIn('CAT_STATION.OBL_ID', $data['regionName']) ->whereBetween('YEAR_CH', [$newDateFrom[0], $newDateTo[0]]) ->whereBetween('MONTH_CH', [$newDateFrom[1], $newDateTo[1]]) ->get();