vendredi 30 novembre 2018

How to count table column data and display in google bar charts in Laravel?

working with Laravel 5.6 and mysql db. an I have table as vehicles like this?

id  name  type  
1   nhy   car
2   juy   van
3   nhy   car
4   kiu   bus
5   hyu   van
etc

currently I am displaying all vehicles numbers using following controller function,

public function vehiclebarchart()
    {
    $chart = Charts::database(Vehicle::all(), 'bar', 'google')
    ->elementLabel("Total")
    ->GroupByDay();
        return view('summarys.vehiclebarchart',compact('chart'));
    }

but now I need display each vehicles types in bar charts like car,van,bus... with counting then, how can I configure controller sql query like above query

$chart = Charts::database(Vehicle::all(), 'bar', 'google')

for my new requirements?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Pa9ZAw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire