withSum instead of withCount


i use withCount to get the amount of belonging items but how do i get the sum of belonging values is there something like withSum?


Made it work like this, please tell me if there is a better way?

    Database.raw('(select taskhours.customer_id, CAST(sum(taskhours.hour) as float) as totaltaskhours from taskhours where taskhours.deleted_at is null group by taskhours.customer_id) as tth'),