In the below function, $input['num_opt'] cannot access $input
$input = $request->all();
$validator->after(function($validator) {
$num_opt = $input['num_opt'];
if ($this->isValidOpt($num_opt)) {
$validator->errors()->add('num_opt', 'Something is wrong with this field!');
echo 'test';
}
});
what is the best practice to pass $input inside the function.