function scopeUpcoming($query)
{
$date = Carbon::now()->addDays(7);
return $query->where('start_date', '>', $date);
}
maybe this?
Kryptonit3 said:
function scopeUpcoming($query) { $date = Carbon::now()->addDays(7); return $query->where('start_date', '>', $date); }
maybe this?
That is a possibility but that would do from whatever the day is, so a week would go from mon to mon, tues to tues, wed to wed, etc..
I think i've nailed it:
This sunday: 2015-02-22
This monday: 2015-02-23
Next sunday: 2015-03-01
Next monday: 2015-03-02
This sunday: {{ Carbon::parse('this sunday')->toDateString() }}
This monday: {{ Carbon::parse('this monday')->toDateString() }}
Next sunday: {{ Carbon::parse('next sunday')->addDays(7)->toDateString() }}
Next monday: {{ Carbon::parse('next week')->addDays(7)->toDateString() }}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community