Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] allow to reset forced scheme and root-url #34039

Merged
merged 2 commits into from Aug 28, 2020
Merged

[7.x] allow to reset forced scheme and root-url #34039

merged 2 commits into from Aug 28, 2020

Conversation

Gummibeer
Copy link
Contributor

Right now it's not possible to clear/reset a forced scheme or root-url.
This is one way to create links to different URLs - for example in emails a link to a dedicated frontend.
https://twitter.com/m1guelpf/status/1283175178961387520

url()->to('/'); // http://localhost:8000

url()->forceScheme('https');
url()->forceRootUrl('https://frontend.local');

url()->to('/'); // https://frontend.local

url()->forceScheme(null);
url()->forceRootUrl(null);

url()->to('/'); // ://localhost:8000

I would expect the last one to be equal to the first one - instead I get an URL without any scheme.

This PR fixes this by setting null to the property if the forced value is empty/null/false.

@driesvints driesvints changed the title allow to reset forced scheme and root-url [7.x] allow to reset forced scheme and root-url Aug 27, 2020
@taylorotwell taylorotwell merged commit 6dd25f4 into laravel:7.x Aug 28, 2020
@Gummibeer Gummibeer deleted the patch-2 branch August 28, 2020 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants