['required', 'integer', 'exists:goods_types,id'], ]; } public function arrayRules($arrayName) { $arrayRules = []; $rules = $this->rules(); foreach ($rules as $key => $val) { $arrayRules[$arrayName . $key] = $val; } return $arrayRules; } }