It appears that you are trying to access the $request variable inside the validator method, but it's not defined in the method's signature. The $request variable is typically available in controller methods, not in validation methods.
To solve this issue, you can update the validator method to accept the $request variable as a parameter. Here's how you can modify your code: