mercredi 18 juillet 2018

Obtain total sum of a table by type enum in laravel with Eloquent

I currently have a table with a column type that is basically an enum field, and another field amount

Table

-id int
- tipo enum('x','y');
- mount decimal

what I want is to get the total sum of the records for each enum value in the table with Eloquent

Result

 name =x , total =n ;
 name =y , total =m ;



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire