How do I use the created_at field to get only the records that were created last week and all the weeks of the month and monthly in laravel 4.2 and 5+ versions?
To fetch record which inserted within one week in laravel, simple example below..
$7days_ago_date = date('Y-m-d', strtotime('-8 days', strtotime(date('Y-m-d'))));
$Tracker = Tracker::orderby('created_at', 'desc')->whereBetween(
DB::raw('date(created_at)'), [$7days_ago_date, date('Y-m-d')] )->get();