Email addresses
EmailInput::make('email')->warnDuplicates(Customer::class, 'email') compares with the customers’ email column. Capital letters don’t matter.
The name shown for each record
label: fn (Customer $record) => … decides the name in the notice. Without it, the resource’s record title is used (here the customer name).
Where “Open” goes
Without settings, “Open” goes to the record’s edit page (or view page) when you may open it. url: fn (Customer $record) => … sends it somewhere else; this field opens the Customers list searched for the name.
Search only some records
query: fn (Builder $query) => $query->where('country', 'US') narrows the search, for example to leave out archived records. This field only looks at customers in the United States.
Turn the warning on and off
condition: turns the warning on or off, with true/false or a function. Here the switch above the field decides.
Refuse duplicates
The warning never stops saving. To refuse a duplicate, add Laravel’s rule as well: ->unique(Customer::class, 'email').
The record being edited is left out
When you edit a record, the field doesn’t warn about the record itself, only about the others. The Customers edit form uses ->warnDuplicates(Customer::class) on Email, Phone and Website.
Note: Try it
Open Customers and then Bayside Grocers. Click in Email (orders@baysidegrocers.com) and then outside it: no notice. Change it to hello@beaconhillbakery.com: Beacon Hill Bakery is named.