Laravel Validation - How to check if a value exists in a given array?

Update: You are now able to use the Rule class instead of imploding values yourself as described in the correct answer. Simply do:

['someProperty' => ['required', Rule::in(['needed', 'stuff'])]];

As mentioned in the 'validating arrays' section in the documentation: https://laravel.com/docs/5.6/validation#validating-arrays


Implode the array as a string and join it on commas.

'employee' => 'required|in:'.$employee->implode('id', ', '),

This will make the correct comma separated string that the validator expects when making an in comparison.

Edit

This still works, but is not the Laravelesque way of doing it anymore. See the answer by @nielsiano.