laravel eloquent raw sum column code example
Example 1: sum two columns in eloquent
\App\Models\YourModel::sum(DB::raw('field1 + field2'));
Example 2: sum row data and get all data eloquent laravel
$balance = DB::table('data')->where('user_id' '=' $id)->sum('balance');