Sometime for such queries you need todisable the strictcheck
So inside config/database.php and inside mysql,
Set'strict' => false,
->select('user_id', DB::raw('SUM(points) as total_points'))
Auth::user()->products->sum('price');
// And on your App/User.php you need someting like this:publicfunctionproducts(){
return Products::where('id_buyer', Auth::user()->id)->get();
}