I am working with laravel and using eloquent to query my SQL database, I need to make a query to get the records of a table. Said query should only bring the data that was created 10 days ago and that is not validated.
Modelo::where('Validacion', '!=', 1)
->whereDate('created_at', '=', Carbon::now()->format('Y-m-d'))
->get();
I don't know how to calculate the current date minus 10 days.
You could subtract the days like this:
Or this other one:
I also leave you the link to the documentation: https://carbon.nesbot.com/docs/#api-addsub .
Luck!
I leave you this variation that is a little more correct and I explain why
you can do it like this I leave you this query model so that you can adapt it to your needs
I did it that way and it has worked for me to check the sales of 10 days ago