phplaravellaravel-validationlaravel-fortify

Unablen to change Laravel Fortify CreateNewUser Validation


I just installed fortify in a new project am working and would like to change the validation rules. Changing the is not actually the problem, the problem is after i have changed the validation errors, am still getting the default validation errors for name,email and password whereas i have totally removed name field from the validation rules.

Here is my CreateNewUser validation Code

Validator::make($input, [
    'first_name' => ['required', 'string', 'max:255'],
    'last_name' => ['required', 'string', 'max:255'],
    'email' => [
        'required',
        'string',
        'email',
        'max:255',
        Rule::unique(User::class),
    ],
    'phone_number' => [
        'required',
        'string',
        'max:20',
        Rule::unique(User::class),
    ],
    'password' => $this->passwordRules(),
])->validate();

and when i make a request to /register route i get:

"name":["The name field is required."],"email":["The email field is required."],"password":["The password field is required."]}

i have also ran php artisan cache:clear php artisan view:clear, php artisan config:clear but am still getting the same result


Solution

  • So after a close look at php artisan route:list, i discovered that the register route is connected to App\Http\Auth\RegisterController. enter image description here Which may be as a result of laravel ui i installed. so, i have to uninstall it or use switch over to using laravel ui RegisterController. i hope that makes sense