I tried to make a Laravel 5.8 project, and the data in the project is like this :
id  |purch| name         |  prcvalue
------------------------------------
1   |10234| Nabila       | 100
2   |10234| Nadeera      | 450
3   |10234| Nabila       | 540
4   |10234| Nadeera      | 480
then i need to show that data like this :
id  |purch| name         |  prcvalue
------------------------------------
3   |10234| Nabila       | 540
4   |10234| Nadeera      | 480
I have tried using GroupBy = name and OrderBy prcvalue DESC but it just return :
id  |purch| name         |  prcvalue
------------------------------------
1   |10234| Nabila       | 100
2   |10234| Nadeera      | 450
does anyone know how i can get the results that i need? here my code :
myModel::where('purch','=','10234')
      ->orderBy('prcvalue','DESC')
      ->groupBy('name')
      ->get();
many thanks
 
     
    