waqar
waqar

Reputation: 75

How can I create a referral link in Laravel?

I am a beginner in Laravel and want a referral link like this one:

domain.com/register?ref=username&pos=Left or right

I have tried:

{{url('/')'./register?ref=Auth::user()->name}}

I have also tried:

{{ route('register',ref=Auth::user()->id)}}

But both lines are not working and giving me errors. So, how can I create a referral link?

Upvotes: 0

Views: 2487

Answers (1)

Tudor
Tudor

Reputation: 1898

Not sure how your routes are defined, so a quick and dirty solution would be this

{{ url('/register?ref=' . Auth::user()->name) }}

Upvotes: 1

Related Questions