Ggwppino's avatar

expressions in withSum with Laravel 10

Before the update inside the withSum() function I could insert an expression as a column, in my specific case I multiplied the value of two columns.

->withSum(rel, DB::raw('column1 * column2'))

With laravel 10 I can't do that, because Eloquent translates the multiplication between two columns as a single column with that name.

Has anyone run into the same problem and found a solution?

0 likes
1 reply

Please or to participate in this conversation.