I have laravel validation request form, like this:
public function rules()
{
$id = $this->input('wlId');
return [
'id' => ['sometimes ', 'integer'],
'domain_name' => ['required', 'string', 'unique:white_label,domain_name' . $id],
'disabled' => ['required', 'boolean']
];
}
I set id for ignore my entry during the unique check, but if id is't an integer but for example a string then I will get sql error from validator.
How can I stop validation if the id field fails validation?
'id' => ['sometimes ', 'integer'],
That means that should be only integer, but if you want to be an integer you should use 'numeric' – Marinario Agalliu