laravel sum rows code example
Example 1: laravel eloquent sum column
Product::where('id',$id)->sum('quantity');
Example 2: sum row data and get all data eloquent laravel
$balance = DB::table('data')->where('user_id' '=' $id)->sum('balance');
Example 3: laravel find query
foreach ($flights as $flight) {
echo $flight->name;
}