Laravel 将输入值放入来自输入数组的错误消息中

Laravel 将输入值放入来自输入数组的错误消息中,laravel,laravel-8,laravel-validation,Laravel,Laravel 8,Laravel Validation,我有一个输入数组,需要检查«distinct»语句。如果验证失败,我必须输出错误消息,如:«属性大小有重复项» 如果我只是在消息中添加int索引,它可以正常工作: 'propertyNames.*.distinct' => 'Parameter «'.$this->propertyNames[0].'» has duplicates' 但是如何在$this->propertyNames[]中放置一些关键变量,而不是0 ($this->propertyNames[]包含输入值)

我有一个输入数组,需要检查«distinct»语句。如果验证失败,我必须输出错误消息,如:«属性大小有重复项»

如果我只是在消息中添加int索引,它可以正常工作:

'propertyNames.*.distinct' => 'Parameter «'.$this->propertyNames[0].'» has duplicates'
但是如何在
$this->propertyNames[]
中放置一些关键变量,而不是0

$this->propertyNames[]
包含输入值)