Friends, many times we face such conditions that we have to calculate the data month wise and year wise and show it in front of us, then we can do this method very easily and how can we do it, I have written the code below, you can read its details:
<?php $datas = DB::table('order') ->whereYear('created_at', '2021') ->whereMonth('created_at', '04') ->sum('total'); echo $datas; ?>