I want Distinct value from a column and orderby another column from a mysql database. mysql table has following data
_________________________
|id |publisher_id |view |
|1 |1 |6 |
|2 |4 |4 |
|3 |1 |3 |
|4 |3 |2 |
|5 |4 |3 |
|6 |2 |1 |
|7 |3 |7 |
|8 |5 |9 |
-------------------------
I want output as follow
_________________________
|id |publisher_id |view |
|8 |5 |9 |
|7 |2 |7 |
|1 |1 |6 |
|2 |4 |4 |
-------------------------
Laravel Query
Feed::query()->select('publisher_id', 'view')->distinct()->orderBy('view', 'DESC')->limit(4)->get();