Laravel absolute URLs from background queue
For a project I use background queues to send confirmation emails. In the Blade template of this email I use the
link_to_route() helper function. But when sending the emails through the background queue the domain for this link defaulted to localhost.
Normally Laravel falls back to the domain of the request, but that is not available when code runs in the background queue. I fixed this by adding the following line of code to the
register() method of my
In my case I also added a
APP_URL environment variable, because I want to set the correct URL for all environments of the app, and chaged the code to the following: