get month and year from data laravel code example
Example 1: where year month laravel
$q->whereDay('created_at', '=', date('d'));
$q->whereMonth('created_at', '=', date('m'));
$q->whereYear('created_at', '=', date('Y'));
Example 2: get current month record in laravel
User::whereMonth('created_at', date('m'))
->whereYear('created_at', date('Y'))
->get(['name','created_at']);