laravel5.2如何从多个复选框中获取值

时间:2017-01-09 18:13:55

标签: html laravel-5.2

@foreach($items as $item)
    <tr>
      <td><input type="checkbox" name="check_delete[]" value="{{$item->item_num}}" /></td>
        <td>{!! $item->item_num !!}</td>
        <td>{!! \App\Category::where('cat_id',$item->model)->first()->cat_name !!}</td>
        <td>{!! \App\Category::where('cat_id',$item->model)->first()->selling_price !!}</td>
        <td>{!! $item->color !!}</td>
        <td>{!! $item->production_year !!}</td>
        <td>
            <a style="width: 80%"
               href="{!! action('CategoriesController@edit', $item->model) !!}">Edit</a>
        </td>
        <td>
            <div>
                <a href="{!! action('ItemsController@edit', $item->item_id) !!}"
                   class="btn btn-info">Edit</a>
            </div>
        </td>
        <td width="8%">
            <div>
                <a href="{!! action('ItemsController@delete', $item->item_id) !!}"
                   class="btn btn-danger" onclick="return confirmDelete();">Delete</a>
            </div>
        </td>
        {!! Form::open(array('url'=>'/entry/print/bar-code/'.$item->item_num)) !!}
        <td width="8%">
            <div>
                {!!Form::number('numToPrint'.$item->item_num,null,array('class'=>'form-control pull-right','placeholder'=>'Number of Copies To Print','style'=>'width:100%','id'=>'numToPrint'.$item->item_num)) !!}
            </div>
        </td>
     <td width="8%">

   <div><button href="{!! action('ItemsController@printBarCode', $item->item_num) !!}" class="btn btn-primary">Print</button>
            </div>
        </td>
        {!! Form::close() !!}
    </tr>
@endforeach
</tbody>
<td width="8%">
    <div>
        <a href="{!! action('ItemsController@delete_by_checks') !!}"
           class="btn btn-danger" onclick="return confirmDelete();">Delete by checks</a>
    </div>
</td>
</table>
@endif

这是我的路线

Route::get('entry/delete/item', ['uses' => 'ItemsController@delete_by_checks']);

当我点击检查删除和写dd($request->check_delete)时我得到的问题。我试图通过表单中的检查进行删除但不起作用。

我想点击删除时通过支票我获得所有检查项目的价值。这个问题累了我,请任何人告诉我如何解决,

1 个答案:

答案 0 :(得分:0)

您希望将复选框放在表单中,但您无法从decltype对象访问它。

只需将$request放在{!! Form::open !!}之后<tr> {!! Form::close() !!}

之前