简体   繁体   English

laravel:laravel Vue ui 中的默认验证在哪里?

[英]laravel: Where is the default validation in laravel Vue ui?

Would someone please point me to where to look to learn how to use/customise the validation functions used by laravel Vue ui in front end.有人请指出我在哪里可以学习如何使用/自定义laravel Vue ui在前端使用的验证功能。 I can't seem to find where the code for the validations for various forms.我似乎无法找到各种表单验证的代码。 For example the email filed as shown bellow.例如,提交的电子邮件如下所示。

Example:例子:

在此处输入图片说明

The error you are submitting is not from the backend.您提交的错误不是来自后端。 It is a generic browser validation, since it is an email type input.这是一个通用的浏览器验证,因为它是一个电子邮件类型的输入。

However, to modify the form fields that are required when a new user registers with your application, or to customize how new users are stored into your database, you may modify the RegisterController class.但是,要修改新用户向您的应用程序注册时所需的表单字段,或自定义新用户如何存储到您的数据库中,您可以修改RegisterController类。 This class is responsible for validating and creating new users of your application.此类负责验证和创建应用程序的新用户。

The validator method of the RegisterController contains the validation rules for new users of the application. RegisterController的验证validator方法包含应用程序新用户的验证规则。 You are free to modify this method as you wish.您可以随意修改此方法。

The create method of the RegisterController is responsible for creating new App\\User records in your database using the Eloquent ORM. RegisterControllercreate方法负责使用 Eloquent ORM 在您的数据库中创建新的 App\\User 记录。 You are free to modify this method according to the needs of your database.您可以根据数据库的需要自由修改此方法。

/**
 * Get a validator for an incoming registration request.
 *
 * @param  array  $data
 * @return \Illuminate\Contracts\Validation\Validator
 */
protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => ['required', 'string', 'max:255'],
        'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
        'password' => ['required', 'string', 'min:8', 'confirmed'],
    ]);
}

If you want to edit the validations on the frontend side you can look at all the views inside the resources/views/auth folder如果你想在前端编辑验证,你可以查看resources/views/auth文件夹中的所有视图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM