2

While creating the user, I want the adhar_number, phone_number and email as unique in laravel nova.

I tried doing the following,

public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),

            Text::make('Adhaar Number')->rules('required'), 

            Text::make('Phone Number')->rules('required'),

            Text::make('Email')->rules('max:255', 'required')
                ->creationRules('unique:users,adhaar_number,phone_number,email'),

        ];
    }

The above field definition gives a success message that resource has been created, whereas it should produce error message. In the log file it logs the duplicate entry error.

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.