Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get count of results based on groupBy laravel

$getUserCountries = User::select('country', DB::raw('count(*) as count'))
                          ->groupBy('country')
                          ->get()->
                          toArray();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #count #results #based #groupBy #laravel
ADD COMMENT
Topic
Name
3+3 =