I don't think that there is a way to pass route parameters to a Form::open that uses routes.
My proposal is that we can pass an array for the route key's value like this:
Form::open (array ('method'=>'put', 'route'=>array($routeName [,params...]))
and in the Illuminate\Html\FormBuilder's getAction() 537:
$routeParams = (array) $options['route'];
$route = array_shift($routeParams);
return $this->url->route($route, $routeParams);
Fixed. Good catch!
What about if my route looks like that ?
Route::post('/kpi/:id/settings', array('as' => 'kpi.settings.save', 'uses' => 'KpiController@saveSettings'));
This doesn't seem to work:
{{Form::open(array('route' => array('kpi.settings.save', array('id' => 1))))}}
@fanals, do you need to use {id} instead of :id? I'm new to Laravel but haven't seen that syntax using a colon.
Thanks @bahoo
I have no idea why I used a colon. So yes it works just by using:
{{ Form::open(array('route' => array('kpi.settings.save', 1))) }}
Most helpful comment
Thanks @bahoo
I have no idea why I used a colon. So yes it works just by using: