jeudi 4 juin 2020

How to orderBy duplicates in Laravel?

I have a Users table in Laravel and in the table I have a column of Package and ReferredBy.

ReferredBy field contains the referral email and many users can have the same referral email. This may sound like many to one relationship but instead of creating another table for referrals, we want to implement the functionality in our current flow.

I want to show the top 10 referral users descending order by the packages(1 basic package, 3 premium package).

How can I achieve this using Laravel eloquent or DB query?

Expected Output: 1. [User With The Most Referrals] . . .



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

Aucun commentaire:

Enregistrer un commentaire