How to Generate a Signed Temporary URL in Laravel
in this lesson, we will see how to generate a signed temporary URL in Laravel, Let's assume that we want to send a confirmation code to a user via email and the URL must have an expiration date and time, and needs to have a signature to make it unchangeable.
Create a Laravel signed URL
To create a temporary signed URL, we use the temporarySignedRoute method of the URL facade, the first param is the route name, and the second is the expiration date and time here we make it expire after 10 minutes and the third param is the user email.
use Illuminate\Support\Facades\URL;
URL::temporarySignedRoute('user.code', now()->addMinutes(10), ['email' => $email]);