laravel get sum of relationship 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');