Hi Guys this is my Table called "inputs". I would like to sum the values having the same TID :
re | in_ID| Value |
=========================
1 | 1 | 3 |
2 | 1 | 3 |
3 | 1 | 4 |
4 | 1 | 5 |
5 | 2 | 3 |
6 | 2 | 3 |
7 | 2 | 2 |
8 | 2 | 2 |
my result should be like that
in_ID| sum(Value)|
==================
1 | 14 |
2 | 20 |
my attempt is:
public function sum(){
return production_input::select('in_id' , 'value')->sum('value')->groupBy(['in_id']);
}