args[0] ?? 'user_id'; $userId = $data[$userIdKey] ?? null; if (!$userId) { $this->addError('用户ID不能为空'); return false; } try { // 查询土地是否存在且属于指定用户 $land = FarmLand::where('id', $landId) ->where('user_id', $userId) ->first(); if (!$land) { $this->addError("土地(ID: {$landId})不存在或不属于当前用户"); return false; } // 可选:将土地实例保存到验证对象中,供后续使用 $landFieldKey = $this->args[1] ?? null; if ($landFieldKey) { $this->validation->$landFieldKey = $land; } return true; } catch (\Exception $e) { $this->addError('验证土地归属时发生错误: ' . $e->getMessage()); return false; } } }