Git Product home page Git Product logo

Comments (4)

bencorlett avatar bencorlett commented on August 25, 2024

I'm curious about this. Though it does seem to break a fair bit of the routing that's in place now and I can't really see the advantage of using $this->input->get('productType') as opposed to $productType as a passed parameter to the controller / closure? Maybe I'm missing something.

Ben

from framework.

stephenfrank avatar stephenfrank commented on August 25, 2024

Hi Ben, I don't want to remove route parameters as arguments. I was just looking for a unified way to access route parameters and user input because in some cases (that I'm working with) they're semantically similar.

Something like Input::getWithRouteParameters('myParameter') or Input::allWithRouteParameters() (and perhaps not so ugly).

The second half of my thought process was really the fact that the Request isn't injected into the Controller in any explicit way. The Request is held within the context of the Router and to access it one must appeal to the global App container and eg. $app['router']->getRequest()->input('myParameter') which feels a bit too much like global state for me. I almost expect the request to be injected into the Controller eg:

$this->request->input('myParameter');
$this->request->all();

Anyway I feel like I've talked myself in circles. I can see how easy this will be to add to my BaseController so I might just go back to hacking around on my app until I clear up for myself what I'm really going on about :)

from framework.

bencorlett avatar bencorlett commented on August 25, 2024

Hmm. I have noticed that too, how you have no access to the request from a controller. It has been a bit annoying before for me too. Maybe that's it's own issue

Sent from my iPhone
Please excuse my brevity

On 15/01/2013, at 7:54 PM, stephenfrank [email protected] wrote:

Hi Ben, I don't want to remove route parameters as arguments. I was just looking for a unified way to access route parameters and user input because in some cases (that I'm working with) they're semantically similar.

Something like Input::getWithRouteParameters('myParameter') or Input::allWithRouteParameters() (and perhaps not so ugly).

The second half of my thought process was really the fact that the Request isn't injected into the Controller in any explicit way. The Request is held within the context of the Router and to access it one must appeal to the global App container and eg. $app['router']->getRequest()->input('myParameter') which feels a bit too much like global state for me. I almost expect the request to be injected into the Controller eg:

$this->request->input('myParameter');
$this->request->all();
Anyway I feel like I've talked myself in circles. I can see how easy this will be to add to my BaseController so I might just go back to hacking around on my app until I clear up for myself what I'm really going on about :)


Reply to this email directly or view it on GitHub.

from framework.

taylorotwell avatar taylorotwell commented on August 25, 2024

I don't see a huge need for this at the moment. Thanks for the suggestion.

from framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.