我有这个错误:
ErrorException 未定义的变量:标签
$labels我应该怎么做才能返回getLastMonths()方法?
面板控制器
public function index()
{
$month=12;
$peymentSuccess=Payment::SpanningPayment($month,true);
$peymentunSuccess=Payment::SpanningPayment($month,false);
$labels = $this->getLastMonths($month);// mahe shamsi bar migardoune nasbe jalali morilog
$values['success']=$peymentSuccess->pluck('published');
$values['unsuccess']=$peymentunSuccess->pluck('published');
return view('admin.panel', compact('labels','values'));
}
private function getLastMonths( $month)
{
for ($i=0 ; $i>$month ; $i++)
{
$labels[]=jdate(Carbon::now()->subMonths($i))->format('%B');
}
return $labels;
}
智慧大石
皈依舞