laravel eloquent with relation and sum query 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');