If Clock_Day is a field in your table, you will need to extract the part of the date that you are comparing for each part (Year, Month, Day). You could use whereIn with DB :: raw:
->where(DB::raw('YEAR("Clock_Day")'),$yearofdata) ->where(DB::raw('MONTH("Clock_Day")'),$monthofdata) ->whereIn(DB::raw('DAYOFMONTH("Clock_Day")'),$workdays)
You must use whereYear or whereMonth to compare these values with the fields in your table named “year” and “month”, but since you want to use the same “Clock_Day” field for all comparisons, you need to extract the corresponding data for each part .
source share