Eloquent - Where Date >= date(now) and whereNull('date')
You need to use a closure and the orWhereNull()
:
->where(function($q) {
$q->where('endDate', '>=', date("Y-m-d"))
->orWhereNull('endDate');
})
You can do with two closure where
and orWhere
:
->where(function($query) {
$query->where('endDate', '>=', date("Y-m-d"))
->orWhere('endDate',NULL);
})
You are using both condition , which never give result
->where('endDate', '>=', date("Y-m-d"))
->whereNull('endDate')
Try to use orWhere