php - How to access values of multiple parameters passed to Laravel controller -
I am trying to figure out how to access two (or more) parameters passed to Laravel controller Know how to create a route, and the URL is created correctly, but then I can only use the parameters passed earlier in my controller.
Route:
Route: Receive ('manager / {id} / {parameter2}', array ('as' = & gt;' dosomething ',' Uses '= & Gt; manager controller @ dosoming'));
Where the first parameter is clearly $ ID for managers, and the second criterion is processed by the controller.
See:
& lt; A href = "{URL: route ('do something', array ($ manager-> id, 'parameter2')}}" class = "style class" & gt; do something & lt; / a & gt; ;
Generates the URL:
http: // domain / managers / 1/2
where Using the "id = $ id and parameter2 = $ parameter2" statement, I get an "unknown", which, using $ 2 manager "$ 2" to easily use, 2 parameters " 2 "variable: $ parameter2" error.
What am I doing?
What are the many parameters Is there a better way to pass? I'm specifically asking the "better way" question what I want to do is use 2 parameters to change values in the database table, and by using the 'get' method, Any URL can change the parameter value and therefore can cause mischief. T 'method? I like being able to use a link, because it is designed with the design of my application It works.
Thank you!
I was asked to include the controller, who is happy to do initially, just for testing, as I had said, my controller had a simple return to show the value of the two passed parameters.
Manager Controller:
But I want to be able to do this, the actual name of the function ("dosomething" instead of "update_group") - ('id', '=', $ Parameter2) - & gt; Update (array ('manager_id' = & gt; $ id) where public function update_group ($ id) {DB :: table ('groups') - & gt;); Return Redirect :: Path ('managers.show', array ('id' = & gt; $ id)); }
If I replace $ parameter 2 with a real value, the update table works perfectly, so that the syntax is correct. The point is that Laravel says that $ parameter2 is an undefined variable, despite the fact that the URL has the value of $ parameter2 as you can see above.
And since it happens to me, it may include adding functions to the manager manager, here is the current
manager.php
Square manager eloquent {secure $ table = 'managers'; ... (mutator and error function)}
just change
< Public work update_group ($ id, $ parameter2)
public function update_group ($ id)
Comments
Post a Comment