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

[5.2] Add response method throwResponse() #13473

Merged
merged 1 commit into from
May 9, 2016
Merged

[5.2] Add response method throwResponse() #13473

merged 1 commit into from
May 9, 2016

Conversation

vlakoff
Copy link
Contributor

@vlakoff vlakoff commented May 7, 2016

Here is the use case:

Before:

use Illuminate\Http\Exception\HttpResponseException;

throw new HttpResponseException(redirect()->refresh(303));

After:

redirect()->refresh(303)->throwResponse();

@GrahamCampbell
Copy link
Member

You can only throw 4xx or 5xx. Throwing other responses is a massive hack.

@vlakoff
Copy link
Contributor Author

vlakoff commented May 7, 2016

I'm just looking for a way to immediately trigger response (ideally with session saving, etc.), without having to propagate return values all the way up to the controller entry method.

@taylorotwell taylorotwell merged commit 3d42fd1 into laravel:5.2 May 9, 2016
@vlakoff
Copy link
Contributor Author

vlakoff commented May 11, 2016

Thanks for accepting. Have I already said the terminable middlewares are amazing?

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.

3 participants