laravel sum of relational table column code example
Example: sum row data and get all data eloquent laravel
$balance = DB::table('data')->where('user_id' '=' $id)->sum('balance');
$balance = DB::table('data')->where('user_id' '=' $id)->sum('balance');