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

[Proposal] Controllers have the current request as a property #248

Closed
kapv89 opened this issue Feb 3, 2013 · 2 comments
Closed

[Proposal] Controllers have the current request as a property #248

kapv89 opened this issue Feb 3, 2013 · 2 comments

Comments

@kapv89
Copy link
Contributor

kapv89 commented Feb 3, 2013

I know its a bit far off, but currently controllers derive their state via the callAction method. That means that the code beign written in the action cannot be stateless .. ie, all the actions, when called directly, in a newly 'composed' controller, need a global state.

This issue can be easily resolved by the controller having a request and response property in the controller.
The actions read from request and modify the response.
So the closure that the router forms for wrapping a controller action can just instantiate the controller with the current request, let the controller process the response, and then just return it .. what say ?

@bencorlett
Copy link
Contributor

You know what, I've run into this and I love it. Makes unit testing individual package controllers easier outside the scope of Laravel too.

@taylorotwell
Copy link
Member

I would prefer to keep controllers how they are.

joelharkes added a commit to joelharkes/framework_old that referenced this issue Mar 7, 2019
Add externalReference to roles, also fix some minor api issues. Fixes laravel#248
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

No branches or pull requests

3 participants