Sergej Fomin
Sergej Fomin

Reputation: 2002

Laravel where is "extend" method for "Validator" declared

I will give an analogy to explain what I want:

For example, if I want to read about the "behaviour" of the save() method in:

$model->save();

then I can go to Illuminate\Database\Eloquent\Model

to read what's inside

public function save() {....}

QUESTION: If I want to know the behaviour of extend() in

Validator::extend('','');

Where in the system laravel files should I go?

Thank you in advance!:)

Upvotes: 0

Views: 508

Answers (1)

tkausl
tkausl

Reputation: 14279

Facades are a bit harder to find than other classes, since they only reference a service container binding. You'd have to find the class where this binding is registered to find the backing class.

The easiest way, for official facades, is to just check the Facades Documentation, there is a list of facades and their backing classes at the bottom:

Validator   Illuminate\Validation\Factory   validator

So the Validator facade resolves to the class Illuminate\Validation\Factory which is bound to the service container with the name validator. From here on, it should be easy to find the Illuminate\Validation\Factory class in your vendor directory.

Upvotes: 2

Related Questions