jasondao's avatar

[SOLVED] Start learning on Larcast

Hi guys I'm new to Laravel and started a course at Laracast last week. To be honest I liked Jeffrey Way's voice so much ^^ but sometimes it's pretty hard to understand since there is no subtitle, but I still like it. So today I want to ask about How to get data between two dates with Query in Laravel? Can you guys explain that issue for me, I'm trying to figure it out. Thanks a lot! https://avada.io/

0 likes
1 reply
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

I'm unsure what you already know but let's say you have a model called User with a created_at column in the database

$start =Carbon::now()->subYear();
$now = Carbon::now();
$users = User::whereBetween('created_at', $start, $now)->get();
1 like

Please or to participate in this conversation.