Answers for "Get month from date in laravel query"

PHP
1

get current month record in laravel

User::whereMonth('created_at', date('m'))
->whereYear('created_at', date('Y'))
->get(['name','created_at']);
Posted by: Guest on February-09-2021
0

fetch data based on month and year in laravel

$post = Mjblog::whereYear('created_at', '=', $year)
              ->whereMonth('created_at', '=', $month)
              ->get();
Posted by: Guest on October-13-2020

Code answers related to "Get month from date in laravel query"

Browse Popular Code Answers by Language