Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用update Laravel组合时获取索引_Php_Laravel_Eloquent - Fatal编程技术网

Php 使用update Laravel组合时获取索引

Php 使用update Laravel组合时获取索引,php,laravel,eloquent,Php,Laravel,Eloquent,我需要你的帮助来获取$index,它是更新循环函数的id索引,有什么方法可以检索到它吗?非常感谢您的帮助。您为什么要使用Where。我想你应该用where。或者您甚至可以使用findbe,因为$request->input('id')是一个数组,所以我应该使用where in Asset_component::whereIn('id', $request->input('id'))->update(array( 'asset_status_id' =>

我需要你的帮助来获取$index,它是更新循环函数的id索引,有什么方法可以检索到它吗?非常感谢您的帮助。

您为什么要使用Where。我想你应该用where。或者您甚至可以使用findbe,因为$request->input('id')是一个数组,所以我应该使用where in
    Asset_component::whereIn('id', $request->input('id'))->update(array(
        'asset_status_id' => Asset_status::whereName('Waiting for transfer')->first()->id,
        'technician_id' => $request->input('technician'),
        'lab_id' => Asset_component::find($index)->asset->lab->id,
        'office_id' => Asset_component::find($index)->asset->office->id,
        'require_date' => Carbon::createFromFormat('m/d/Y', $request->input('require_date')),
        'comment' => $request->input('comment'),
        'warehouse_id' => null
    ));