Waqar Ali
Waqar Ali

Reputation: 135

How to add referral link to a image in laravel?

I'm beginner in Laravel . I'm making a referral banner advertise page. I want to display an image that contains user's referral link . Users will copy it and place it show my website ads. if any one clicks on web so redirects to attached link.

<div class="profile-body text-center">
  <h3>{{ Auth::User()->name }}</h3>        
  <h4> Referral link : <span style="color: #fff;font-size: 13px;" class="label label-danger">{{ url('/').'/register?ref='.Auth::User()->reference }}</span></h4>

 <button style="margin-top: 10px;" class="btn has btn-info btn-block btn-icon icon-left" data-clipboard-text="{{url('/').'/register?ref='.Auth::User()->reference }}">
   <i class="fa fa-clipboard" aria-hidden="true"></i>  Copy Reference ID
 </button>

</div>

Upvotes: 0

Views: 162

Answers (1)

user320487
user320487

Reputation:

You probably want to store the referral link with the image name together in a database. If you use Auth::user() that will use the currently logged in user, basically meaning it would always refer to themselves.

Say you have ImageReferral model. Your banner might then look like:

<a href="{{ $imageReferral->reference}}">
    <img src="{{ $imageReferral->src}}" />
</a>

This is a very simplified example.

Upvotes: 1

Related Questions