Laravel:带有url参数的页面上的表单

时间:2018-02-10 13:56:17

标签: php laravel laravel-5

我有如下生成的路线,并希望在页面上放置一个表单:

Route::get('suppliers/dashboards/{supplier}', ['uses'=>'SuppliersDashInvoiceController@index'])->middleware('auth');

Route::post('suppliers/dashboards/{supplier}', array( 'before' => 'csrf', 'uses' => 'SuppliersDashInvoiceController@iprocess'))->middleware('auth');

但是当使用Form laravel helper时,我收到与

相关的错误
Missing required parameters for [Route: ] [URI: suppliers/dashboards/{supplier}]

表格助手:

{!! Form::open(array('action' => array('SuppliersDashInvoiceController@iprocess'))) !!}

有没有人知道如何将{supplier}参数传递给表单打开助手,它没有记录在laravel文档中。

1 个答案:

答案 0 :(得分:4)

您需要传递参数,例如:

{!! Form::open(['action' => ['SuppliersDashInvoiceController@iprocess', $supplier->id]]) !!}

https://laravelcollective.com/docs/5.2/html#opening-a-form