new widget structure

This commit is contained in:
denisdulici
2019-12-31 02:20:10 +03:00
parent 8c6ca5e5fb
commit 71c5caf264
44 changed files with 333 additions and 502 deletions

View File

@@ -7,10 +7,6 @@ use App\Models\Setting\Category;
class IncomeByCategory extends Widget
{
protected $config = [
'width' => 'col-md-6',
];
public function show()
{
Category::with('income_transacions')->type('income')->enabled()->each(function ($category) {
@@ -27,9 +23,20 @@ class IncomeByCategory extends Widget
$chart = $this->getDonutChart(trans_choice('general.incomes', 1), 0, 160, 6);
return view('widgets.income_by_category', [
'config' => (object) $this->config,
return $this->view('widgets.income_by_category', [
'chart' => $chart,
]);
}
public function getDefaultName()
{
return trans('widgets.income_by_category');
}
public function getDefaultSettings()
{
return [
'width' => 'col-md-6',
];
}
}