where(['claim_id'=>$claim_id])->select(); } public function claimHarvestUpdate($claimSpecList,$claim_id){ $ids = []; $claimSpecList = json_decode($claimSpecList,true); Log::write($claimSpecList); Log::write('11--'); foreach ($claimSpecList as $item) { $info = $this->where(['id'=>$item['id']])->find(); if (!$info){ $info = new ClaimHarvest(); $info['claim_id'] = $claim_id; } $info['harvest_name'] = $item['harvest_name']; $info['harvest'] = $item['harvest']; $info->save(); array_push($ids,$info['id']); } $this->whereNotIn('id',$ids)->where('claim_id',$claim_id)->delete(); } public function getSpecInfo($spec_id){ return $this->find($spec_id); } }