Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

robee00's avatar

url('..') returns url without hostname

Hey!

If I call e.g. url('users/activate', [], true), then it returns this url: https://:/users/activate. Why doesn't it insert the host name there? I tried with URL::secure too, nothing changed.

EDIT: It only does it, if I'm calling url() from a Job

0 likes
3 replies
clay's avatar
clay
Best Answer
Level 20

Is your job queued? I'm not familiar with Lumen, but generally speaking, inside a queued job, or any environment outside the normal request lifecycle, the current request doesn't exist. Probably, the url helper tries to use the current request to get the host name but can't find it.

In Laravel, you can set the host name in your configuration, however, I'm not sure about Lumen.

1 like
robee00's avatar

Thanks, yes its not working from a job, but I just passed in the url and works now. thanks :)

Please or to participate in this conversation.