get data by month laravel eloquent code example
Example 1: get current month record in laravel
User::whereMonth('created_at', date('m'))
->whereYear('created_at', date('Y'))
->get(['name','created_at']);
Example 2: fetch data based on month and year in laravel
$post = Mjblog::whereYear('created_at', '=', $year)
->whereMonth('created_at', '=', $month)
->get();