You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a custom validation rule or at least use a closure custom validation but I cannot achieve that the function was called when the request value is empty.
Steps To Reproduce:
Create a closure validation rule
Send an empty value for the attribute
The function is ignored
Example:
<?php
$this->validate($request->all(), [
'users.*.email' => function($attribute, $value, $fail) {
dd("This is not called when the $value (user[0].email = '') is empty");
// My custom condition
// for example only require the email if the user is admin.
}
]);
*Notice that in my real case im validating that the value is in another array in the same request, i mean it will be required based on the value of every item, so some rows will be required and some others not, otherwise i will make a condition like: 'users.*.email' => (/*condition*) ? 'required' : ''
The text was updated successfully, but these errors were encountered:
Description:
I'm trying to create a custom validation rule or at least use a closure custom validation but I cannot achieve that the function was called when the request value is empty.
Steps To Reproduce:
Example:
*Notice that in my real case im validating that the value is in another array in the same request, i mean it will be required based on the value of every item, so some rows will be required and some others not, otherwise i will make a condition like:
'users.*.email' => (/*condition*) ? 'required' : ''
The text was updated successfully, but these errors were encountered: