doudun1934 2018-02-10 13:56
浏览 186
已采纳

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

I have a routes generated as below and want to put a form on the page:

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

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

But when using the Form laravel helper, I get an error relating to

Missing required parameters for [Route: ] [URI: suppliers/dashboards/{supplier}]

Form helper:

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

Does anyone know how to pass the {supplier} parameter to the form open helper, its not documented in the laravel docs.

  • 写回答

1条回答 默认 最新

  • douren5490 2018-02-10 13:58
    关注

    You need to pass parameter, for example:

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

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 (标签-STM32|关键词-智能小车)
  • ¥20 关于#stm32#的问题,请各位专家解答!
  • ¥15 (标签-python)
  • ¥20 搭建awx,试了很多版本都有错
  • ¥15 java corba的客户端该如何指定使用本地某个固定IP去连接服务端?
  • ¥15 activiti工作流问题,求解答
  • ¥15 有人写过RPA后台管理系统么?
  • ¥15 Bioage计算生物学年龄
  • ¥20 如何将FPGA Alveo U50恢复原来出厂设置哇?
  • ¥50 cocos2d-x lua 在mac上接入lua protobuf?