4
4
4sadly2020-08-19 06:56:53
Laravel
4sadly, 2020-08-19 06:56:53

How to get all data for selected month (and year)?

It is necessary to get applications for the selected month from the Ym format date
This method works

Order::whereYear('created_at' , Y)->whereMonth('created_at', m)->get();

Is there an easier option? to work in the same way, for example with Carbon?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2020-08-19
@Fragster

whereBetween('created_at', [$date1, $date2])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question