jeudi 16 janvier 2020

is there a way to group data from the EAV (Entity Attribute Value) table in laravel

hello all is there a way to group data from EAV based on one of the designated rows in laravel? for example i have table like this

_____________________________________________________
id |referal_id|client_detail_name|client_detail_value|
1  |   1      |client_id         | 1                 |
2  |   1      |client_name       | michael           |
3  |   1      |client_address    | new_york          |
4  |   1      |client_sex        | men               |
5  |   1      |client_id         | 2                 |
6  |   1      |client_name       | jachson           |
7  |   1      |client_address    | LA                |
8  |   1      |client_sex        | men               |
9  |   1      |client_id         | 3                 |
10 |   1      |client_name       | julia             |
11 |   1      |client_address    | USA               |
12 |   1      |client_sex        | female            |

is there a way to group by client_id? so my expectation, is to get an array based on client_id

0 => {#1235
  +"client_id": 1
  +"client_name": michael
  +"client_address": new york
  +"client_sex": men
}
1 => {#1222
 +"client_id": 2
  +"client_name": jackson
  +"client_address": LA
  +"client_sex": men
}
2 => {#1222
 +"client_id": 3
  +"client_name": julia
  +"client_address": USA
  +"client_sex": female
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/35VHYFe
via IFTTT

Aucun commentaire:

Enregistrer un commentaire