I want to calculate the sum of the volume flows (attribute) of different ventilation units (model) previously selected by the user.
However, I cannot use
System->whereIn('id', $selectedSystemIDs)->sum('volume_flow') because the user can also select the same units for different rooms.
The array of IDs could look like this:
array:3 [▼ 0 => 9 1 => 10 2 => 10 ]
Is there a Laravel way to do this or do I have to solve it with a loop?