By Laravel documentation the validation rule "in_array", should validate whether a fields value under validation exist as an array value in a different field:
"The field under validation must exist in anotherfield's values."
By checking a simple case it does not seem to do so, in any case I have no understanding what this validation rule actually does. Now, this may be just me misunderstanding something, bet here are the steps to reproduce
$input = [
'locales' => ['EN', 'FR', 'RU'],
'locale' => 'EN'
];
$validation = Validator::make($input, [
'locale' => 'in_array:locales',
]);
$validation->fails(); /* returns true, expected false */
(v5.3.20/src/Illuminate/Validation/Validator.php in line 1053)
By taking a look at the source, the problem arises in calling Arr::dot on $attributeData
which produces an array like this ['locales.0.' => 'EN', ..., ...], that will never be
equal to "locales", therefore the closure of Arr::where will return an empty array;
use in_array:locales.*
Most helpful comment
use
in_array:locales.*