Answer the question
In order to leave comments, you need to log in
How to return records grouped by dates?
A question. There is a Post model. It has a link to Comment. It is necessary to return in json Post and comments by dates of the form: today, yesterday, 10/20/2010, etc. Not necessarily of course Today and Yesterday, but I would like to)
I try this, but the model with the connection simply returns:
$post = Post::where('id', $id)->with('comments')->groupBy('created_at')->get();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question