Home > Mobile >  how to add a href link in a variable in laravel
how to add a href link in a variable in laravel

Time:10-15

I have created a variable inside a controller whereby I want to put a href link inside the variable. everything works well but I want to add a download link for the to be able to view the link in the message sent to them.I have tried this but the URL isn't being rendered in the message.I haven't understood where am doing it wrong.

 $downloadurl="'downloadpaymentreceipt/$payment->id/$payment->date_paid'";

        // Set your message
$message = "hello there your payment has been received.Click <a href=$downloadurl>Here</a> to downoad your receipt.";

CodePudding user response:

use the back cotes (``)

$message = "hello there your payment has been received.Click `<a href=$downloadurl>Here</a>` to downoad your receipt.";

CodePudding user response:

Try this

$message = 'hello there your payment has been received.Click <a 
     href="' . $downloadurl . '">Here</a> to downoad your receipt.";

Or like this

$message = "<p>hello there your payment has been received.Click <a 
   href='{$downloadurl}'>Here</a> to downoad your receipt.</p>";
  • Related