I've an Event model with belongtomany Date model
public function dates () {
return $this->belongsToMany('App\Date', 'event_date');
}
Every Date have a start and an end date.
Es:
Event->name = StackOverflow Meeting
Event->dates() =
[0] ('start' => 01-24-2018, 'end' => 01-27-2018)
[1] ('start' => 04-24-2018, 'end' => 04-27-2018)
Event->name = Easter Party
Event->dates() =
[0] ('start' => 04-18-2018, 'end' => 04-19-2018)
I want to order events by start date based on today date, so in the example "Easter Party" is the first event because have the first start date > today date. Then:
('Easter Party', 'StackOverflow Meeting')
How can I manage to create an order of this kind?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2G9AYLQ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire