Extending the Validator class in Laravel
问题 I wanted extend the Validator class in Laravel. However in all examples the make method is used to create a new instance which I can't find in the Validator source code. How can I override this method? The constructor requires a TranslatorInterface instance so that doesn't seem to be an option? 回答1: The make method is actually in Illuminate\Validation\Factory. If you want to extend this method then you'll need to swap out the IoC binding. Just overload the binding in the container. App: