how to check exist in array in rule validation laravel 1

how to check exist in array in rule validation laravel

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

Here is what the above code is Doing:
1. We’re creating a new instance of the Validator class.
2. We’re passing in the data we want to validate.
3. We’re passing in the rules we want to validate against.
4. We’re calling the passes() method to check if the data passes the validation rules.
5. If the data passes the validation rules, we’re returning a success message.
6. If the data fails the validation rules, we’re returning a failure message.

Similar Posts