Im relatively new to Laravel and try to make sense of something. I created a basic project and used `
` php artisan make:auth
` to generate a authentication scaffolding.
In the generated views, the $errors variable is available. I know that this can be inserted into a view by using the withErrors() method.
However, I can't seem to find how this is inserted in the example. Under the hood the following function seems to be handling registration:
/**
* Handle a registration request for the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user);
return $this->registered($request, $user)
?: redirect($this->redirectPath());
}
So the validator method of the default RegisterController is called, and it returns a validator. But i cannot grasp how the errors from the validator are inserted into the auth.register view.