Ad

L5 Form Model Binding With Multiple Parameter

- 1 answer

How to make Form::model with multiple parameter? i have example route like this. www.domain.com/product/2/product-attributes/3/edit in normal form i can do it like this:

<form method="POST" action="{{ route('product.{product}.product-attributes.update', [$product->id, $product-attribute->id ]) }}"> </form>

but if im trying to use laravelcolective/html Form::model() like this:

Form::model($productattributes, array('method' => 'POST', array('route' => array('product.{product}.product-attributes.update', [$product->id, $product-attribute->id ])))

i get an error array to string conversion...

==== UPDATE ==============

My Routes:

Route::resource('backend/product', 'Backend\ProductController');
Route::resource('backend/product/{product}/product-attributes', 'Backend\ProductAttributesController',['except' => ['index']]);

===== UPDATE 2 =========================

already solved but i will prove my route not wrong php artisan route:list enter image description here

Ad

Answer

im just trying.. if normal route use array to pass multiple parameter. i guess Form::model dont need to use array just separate with ,

Normal Route ::

<form method="POST" action="{{ route('product.{product}.product-attributes.update', [$product->id, $product-attribute->id ]) }}"> </form>

Form Model ::

Form::model($productattributes, array('method' => 'POST', array('route' => array('product.{product}.product-attributes.update', $product->id, $product-attribute->id)))
Ad
source: stackoverflow.com
Ad