G
G
GrimJack2017-09-05 12:45:44
Laravel
GrimJack, 2017-09-05 12:45:44

How to select by date?

Good afternoon. I want to make a scope in the model to select records in a certain period of time (from and to)
There is an updated_at field in the database in the carbon::now() format.
What is the best way to do this?
db postgres

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Melikhov, 2017-09-05
@GrimJack

You don't need a scope, Laravel already has a method for this
Model::whereBetween('column', [$from, $to]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question