kymbrik
11/2/2017 - 3:16 PM

How to use mysql function in eloquent query builder

$this->model::where("created_at", ">=", "NOW()")->get(); DOES NOT WORK

try this:
$this->model::where("created_at", ">=", DB::raw("NOW() - INTERVAL {$hours} HOUR"))->get();