Fixed a bug in relevantOnDate

This commit is contained in:
James Cole 2015-03-24 21:00:42 +01:00
parent fa3f18b60f
commit 6bbaf1523c

View File

@ -37,13 +37,13 @@ class PiggyBankRepetition extends Model
{
return $query->where(
function($q) use ($date) {
$q->where('startdate', '>=', $date->format('Y-m-d 00:00:00'));
$q->where('startdate', '<=', $date->format('Y-m-d 00:00:00'));
$q->orWhereNull('startdate');
})
->where(function($q) use ($date) {
$q->where('targetdate', '<=', $date->format('Y-m-d 00:00:00'));
$q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00'));
$q->orWhereNull('targetdate');
});
}