Ignore the current user on a unique email

Rule::unique()->ignore() lets the signed-in user keep their email. A plain unique rule fails on save.

For your AI agent

Copies a prompt. Paste it into the AI agent you already have open.

Read https://laravel-vuejs.space/laravel-unique-email-vue.md
Rule::unique()->ignore() lets the signed-in user keep their email. A plain unique rule fails on save.
Do not ignore $request->input('id') from the form.
Show the diff. Do not commit.
On this page · 3 sections
  1. The fix
  2. What to avoid
  3. FAQ

People searching “Laravel unique email Vue” hit this on the profile form. The user saves without changing the email, and Laravel says the email is taken. It is taken by the same row.

TL;DR

  • Rule::unique()->ignore() lets the signed-in user keep their email.
  • A plain unique rule fails on save.
  • Do not ignore $request->input('id') from the form.

Who it's for: Laravel + Vue developers on Inertia

Applies to: Laravel 13 · Inertia 3 · Vue 3

The fix#

The Fortify guide owns login. This page is the update rule.

php
use Illuminate\Validation\Rule;

$validated = $request->validate([
    'email' => [
        'required',
        'email',
        'max:255',
        Rule::unique('users', 'email')->ignore($request->user()->id),
    ],
]);

$request->user()->update(['email' => $validated['email']]);

ignore() drops the current id from the uniqueness query. Pass the id, not the whole request.

On the Vue page, print form.errors.email under the email input. The message is the normal unique sentence. You do not need a second error format.

What to avoid#

Gotcha

Do not ignore $request->input('id') from the form. A visitor can change that hidden field and skip the unique check against someone else.

FAQ#

How do I ignore the current user on a unique email?

Rule::unique()->ignore() lets the signed-in user keep their email. A plain unique rule fails on save.

What goes wrong with Laravel unique email Vue?

Many developers hit this on the profile form. Do not ignore $request->input('id') from the form.

Found this useful?

Ask questions, share what you built.

Join thousands of Laravel and Vue developers in our Facebook group, or get new posts in your Telegram feed. Sharing this article helps too.

Keep reading

Newsletter

Get the best of Laravel & Vue, once a month.

One short email with new guides, release notes worth reading and hand-picked community links. No spam, unsubscribe any time.