I have two models Tour
and Adventure
. I want to make a group of both tours and adventures grouped by date. And display it like this:
July 17
Tour 1 Tour 2 Tour 3 Adventure 1 Adventure 2 Adventure 3
July 16
Tour 1 Tour 2 Tour 3 Adventure 1 Adventure 2 Adventure 3
I know how to make the grouping of a single model. It goes like this:
Tour::orderBy('created_at', 'desc')->take(20)->get()->groupBy(function($item)
{
return $item->created_at->format('d-M-y');
});
How can I join the two models and display them into a single date? With the current code day appear in different collections.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire