Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kikter's avatar

referral Invite basic system

so i was thinking of adding a basic referral system in my project but I don't want to use a referral link instead I would like the user to give invited user his / her username

when the invited User input the invitee User username during registration or after registration then this check if the invitee Username exit then increase the invitee referral count

how can I do this ? how should I structure the database? how do I check if invitee exist?

0 likes
4 replies
Sinnbeck's avatar

So just check if that user exists and increment a counter on that user?

if ($user = User::where('username', $request->input('referrel'))->first()) {
    $user->increment('referrel_count');
}

But personally I would probably keep track of who invited who on a seperate table instead

kikter's avatar

@Sinnbeck thanks , how would I structure the table if I am to follow your own way, how would you do it personally?

Please or to participate in this conversation.