wamesk / nova-email-autocomplete-field
A Laravel Nova field.
Installs: 514
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:Vue
Requires
- php: ^7.3|^8.0
README
Installation
composer require wamesk/nova-email-autocomplete-field
Publishing config
php artisan vendor:publish --provider="Wame\NovaEmailAutocompleteField\FieldServiceProvider" --tag="config"
Usage
Default usage is pretty simple like every other field
By default it autocompletes domains in config file nova-email-autocomplete.php
use Wame\NovaEmailAutocompleteField\Email; Email::make('Email')
Alternatively you can overwrite it and use domains() method
use Wame\NovaEmailAutocompleteField\Email; Email::make('Email') ->domains([ 'gmail.com', 'yahoo.com', ... ])
Check unique
https://nova.laravel.com/docs/resources/validation.html#creation-rules
Email::make(__('user.field.email'), 'email') ->required() ->rules('required', 'email', 'max:75') ->creationRules('unique:users,email') ->updateRules('unique:users,email,{{resourceId}}')
A Show button will appear when a duplicate is found.
If you do not want to display it, set the value to false
.
Email::make(__('user.field.email'), 'email') ->uniqueResource(false)
If you want to redirect to another resource such as a table.
Email::make(__('customer.field.email'), 'email') ->uniqueResource('customers')