![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/job-board.corals.io/Corals/modules/Marketplace/Widgets/ |
<?php namespace Corals\Modules\Marketplace\Widgets; use Corals\Modules\Marketplace\Charts\BrandRatio; use Corals\Modules\Marketplace\Models\Brand; class BrandRatioWidget { function __construct() { } function run($args) { $data = Brand::withCount('products') ->get()->pluck('products_count', 'name')->toArray(); $chart = new BrandRatio(); $chart->labels(array_keys($data)); $chart->dataset(trans('Marketplace::labels.widget.products_by_brand'), 'pie', array_values($data)); $chart->options([ 'plugins' => '{ colorschemes: { scheme: \'brewer.Paired12\' } }' ]); return view('Corals::chart')->with(['chart' => $chart])->render(); } }