validation not exist in table laravel 1

validation not exist in table laravel

    public function rules()
    {
        return [
            'phone_number' =>[
              'required' ,
              'unique:users,phone_number'
            ],
        ];
    }

Here is what the above code is Doing:
1. We are using the `rules()` method to define the validation rules for the request.
2. We are using the `required` rule to make sure that the `phone_number` field is not empty.
3. We are using the `unique` rule to make sure that the `phone_number` field is unique in the `users` table.

Now, let’s add the following code to the `app/Http/Controllers/Auth/RegisterController.php` file:

Similar Posts