比较Laravel 5中的两列

I am using Laravel

Let's say, I have two date fields in my table. If I want to compare them, i can do whereRaw clause.

$query->whereRaw('date1 > date2')->get()

Is there a way to make a modification to date2 inside this query, so it is actually date2-1day?

Something like:

$query->whereRaw('date1 > (date2-1day)')->get()

You are free to call any SQL code in the "raw" part of your query, so you could do sth like below:

$query->whereRaw('date1 > DATE_SUB(date2, INTERVAL 1 DAY)')->get();

Keep in mind that executing SQL code this way will make your queries work only in databases that support such functions.