基于两列计算的雄辩查询

I have a model called quotation which has both a created_at and a valid_for column.

How can a run one eloquent query so that it returns expired quotations (without manually adding a expired_at column e.g. something like this

$quotations = Quotation::where('created_at', '<', Carbon::now()->addDays($this->valid_for));

You need to apply the logic in the sql.

$quotations = Quotation::where(\DB::row('DATE_ADD(`created_at`, INTERVAL `valid_for` DAY)', '>=', \DB::row('CURRENT_DATE'))->get();

I assume your valid_for is number of days.