I'm using Laravel 5.4, and I need to check both event and created date conditions at once. So I used following code.
protected $table = 'qlog';
public $timestamps = false;
public function getAbondonedCalls()
{
$results = DB::table('qlog')
->whereDate('created', '=', DB::raw('curdate()'))
->where('event', '=', 'ABANDON')
->get();
var_dump($results);
die();
}
But this code returns nothing. After removing this line it returns a record.
->whereDate('created', '=', DB::raw('curdate()'))
How to add both conditions?
You should try this:
->whereDate('created', '=', date('Y-m-d'))