When I'm sending a queued mail message from a laravel queue the route urls always return localhost instead of the url set in config app.url. The rest of the site works fine but just urls generated from the queue are wrong.
The url
in app.php
is only used when Laravel runs as a console application. Your URLs where created using the domain name the application runs under: localhost
You can fix this by only generating a relative URL and then prepend the domain name from the config:
$url = Config::get('app.url') . route('route-name', null, false);
(The third argument to route()
is $absolute = true
. By setting that to false you get a relative URL starting with /
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With