https://laravel.com/docs/5.7/eloquent#retrieving-aggregates
Retrieving Aggregates
You may also use the count, sum, max, and other aggregate methods provided by the query builder. These methods return the appropriate scalar value instead of a full model instance:
$count = App\Flight::where('active', 1)->count();
$max = App\Flight::where('active', 1)->max('price'); 
No comments:
Post a Comment