working with laravel 5.6 and mysql db. I have table named as vehicles in my application like this,
id name categoryname
1 lki Car
2 kio Van
3 hytg Car
4 hyu Truck
5 htg Van
etc
Now I am going count numbers of each categoryname as Car 2 Van 2 Truck 1
and display Google Chart using consoletvs/charts. I have one example to displaying existing all users in controller as,
class BarChartController extends Controller
{
public function index()
{
$chart = Charts::database(Vehicle::all(), 'bar', 'google')
->elementLabel("Total")
->GroupByMonth();
return view('charts.bar',compact('chart'));
}
}
so, now I need new controller function to show above my requirement (show each categorynames in charts) how can I configure controller for it?