Right now i am calculating total earning of the user yearly. But i want to show by month.
public function dashboard()
{
$this->data['title'] = trans('backpack::base.dashboard');
$customers = Tag::all();
$total_earnings = 0;
foreach ($customers as $customer) {
if(Auth::User()->gym_code == $customer->gym_code)
$total_earnings = $total_earnings + $customer->amount;
}
// set the page title
$this->data['earnings'] = $total_earnings;
return view('backpack::dashboard', $this->data);
}