如何将两个不同的 id 从 onclick 函数发送到资源路由控制器

How to send two different id's from onclick function to a resource route controller

{{ Form::open(数组('method' => 'DELETE', 'route' => 数组('secureadmin.services.destroy', $est->id), 'onSubmit' =>'return confirm("Are you sure you want to delete this ...?")','id'=>'deleteform'.$est->establishment_id,'style'=>'display: inline'))}}
establishment_id}}').submit()"> {{ Form::close() }} @万一

这是我的控制器代码,当我点击删除时,我想向控制器发送两个不同的 ID。请帮助如何在 onclick 函数中传递两个 id,我正在使用资源路由和 laravel 版本 4.2

您不能使用在资源控制器中创建的 destroy 方法,您必须在现有控制器中创建另一个函数来删除多个值并通过 post 将您的 ID 发送到该函数

  1. 使用 method = post 和 Laravel _method 字段创建表单 删除
  2. 然后使用一些隐藏的输入表单元素将您的 ID 从该表单发送到新建函数。
  3. 通过Request变量在函数中获取这些id并执行 删除