Answers for "laravel get average from a column"

PHP
0

laravel get average from a column

$avgStar = Model::avg('star');
Posted by: Guest on January-24-2021
0

how do we calculate average in laravel 8

{
    $average = collect([1, 5, 9, 5])->avg();
    // Output : 5

    $average = collect([10,20,30])->average();
    // Output : 10
}
Posted by: Guest on December-23-2020

Code answers related to "laravel get average from a column"

Browse Popular Code Answers by Language