If column1 is equal to null I want my column2 to be between two dates in relation to the month and day, and if column1 is not null I want that column (column1) to be between two dates in relation to the month and day, too. All columns are of type date.
I would use this sql query in laravel with tableName->whereRaw ("SQL query"), or directly with the laravel commands if anyone knows how.
I have this for now, it works individually, but not together.
SELECT * FROM tablename WHERE column1 IS NULL AND DATE_FORMAT(column2, '%m-%d') BETWEEN DATE_FORMAT('2005-01-01', '%m-%d') AND DATE_FORMAT('2020-12-30', '%m-%d') AND WHERE DATE_FORMAT(column1, '%m-%d') BETWEEN DATE_FORMAT('2005-01-01', '%m-%d') AND DATE_FORMAT('2020-12-30', '%m-%d')