1,I can get my current year income but don't know how to show all monthly income of current year.
2, if I want to create $selectYear as pick one of the random year then show the specific year monthly income of $selectYear just like question 1.
What I have try only the current/select year income but show monthly income of year, i still stuck there.
this my controller
public function index(){
$selectYear= 2017;
$this->getYearRevenue($selectYear);
//customPickYearRevenue is for totalIncome of $selectYear
$customPickYearRevenue = $this->getYearRevenue($selectYear);
}
private function getYearRevenue($selectYear){
$yearPickRevenue = Order::whereYear('created_at', '=', $selectYear)
->where('order_status', 'Accepted')
->sum('amount');
return $yearPickRevenue;
}
I want to show month with amount(revenue of year)
sorry about hard code $selectYear