How to get monthly wise data in laravel



PHP Snippet 1:

public function RentCertificate(){
$data['fiscal_year'] = FiscalYear::all();
$data['month'] = Month::all();
$data['report'] = Report::status(1)->desk(15)->distric()->rentcertificate()->groupBy('month')->where('month','January')->get();
$data['upazila'] = Upazila::all();
$data['upazilaoffice'] = UpazilaOffice::all();
$data['user'] = User::all();
$data['districoffice'] = DistricOffice::all();
return view('adcr.report.rent_certificate', $data);
}

PHP Snippet 2:

public function RentCertificate($month){
$data['fiscal_year'] = FiscalYear::all();
$data['month'] = Month::all();
$data['report'] = Report::status(1)->desk(15)->distric()->rentcertificate()->groupBy('month')->where('month',$month)->get();
$data['upazila'] = Upazila::all();
$data['upazilaoffice'] = UpazilaOffice::all();
$data['user'] = User::all();
$data['districoffice'] = DistricOffice::all();
return view('adcr.report.rent_certificate', $data);
}