• Home
  • Blogs
  • Customizing Laravel Breeze Registration
Blog Details

Customizing Laravel Breeze Registration

Out of the box, Laravel Breeze only collects Name, Email, and Password when registering a new user.

But in real-world projects, you’ll often need extra fields such as:

  • Username

  • Phone number

  • Profile picture

  • Role (admin, user, editor, etc.)

In this guide, we’ll customize Laravel Breeze registration step by step.


Step 1: Add New Columns to Database

Let’s add username and phone fields to the users table.

Run migration command:

php artisan make:migration add_username_phone_to_users_table --table=users

This will create a new migration file in database/migrations/.

Update it like this:

 
public function up(): void
{
    Schema::table('users', function (Blueprint $table) {
        $table->string('username')->unique()->after('name');
        $table->string('phone')->nullable()->after('email');
    });
}

Run migration:

php artisan migrate

Database now supports username & phone.


Step 2: Update User Model

Go to app/Models/User.php and allow mass assignment:

protected $fillable = [
    'name',
    'username',
    'email',
    'phone',
    'password',
];

Step 3: Update Registration Form

Open resources/views/auth/register.blade.php and add fields:

        <!-- Username -->
        <div>
            <x-input-label for="username" :value="__('Username')" />
            <x-text-input id="username" class="block mt-1 w-full" type="text" name="username" :value="old('username')" required autofocus autocomplete="name" />
            <x-input-error :messages="$errors->get('username')" class="mt-2" />
        </div>

        <!-- Phone -->
        <div>
            <x-input-label for="phone" :value="__('Phone')" />
            <x-text-input id="phone" class="block mt-1 w-full" type="text" name="phone" :value="old('phone')"  autofocus autocomplete="name" />
            <x-input-error :messages="$errors->get('phone')" class="mt-2" />
        </div>

 


Step 4: Update Registration Controller

Open app/Http/Controllers/Auth/RegisteredUserController.php.

Modify validation and user creation logic:

 
    public function store(Request $request): RedirectResponse
    {
       $request->validate([
        'name' => 'required|string|max:255',
        'username' => 'required|string|max:255|unique:users',
        'email' => 'required|string|email|max:255|unique:users',
        'phone' => 'nullable|string|max:20',
        'password' => 'required|string|confirmed|min:8',
    ]);


        $user = User::create([
        'name' => $request->name,
        'username' => $request->username,
        'email' => $request->email,
        'phone' => $request->phone,
        'password' => Hash::make($request->password),
    ]);

        event(new Registered($user));

        Auth::login($user);

        return redirect(route('dashboard', absolute: false));
    }

Laravel Breeze Customization


Step 5: Show New Fields on Dashboard

Open resources/views/dashboard.blade.php and display user details:

<h2>Welcome, {{ auth()->user()->name }} 🎉</h2>
<p>Username: {{ auth()->user()->username }}</p>
<p>Email: {{ auth()->user()->email }}</p>
<p>Phone: {{ auth()->user()->phone ?? 'Not Provided' }}</p>

Conclusion

Now your Laravel Breeze registration is customized with extra fields:
✔️ Username
✔️ Phone

This makes your authentication production-ready for real projects.

Leave A Reply

Your email address will not be published. Required fields are marked

Ahmad

Ahmad Raza

Hi, I'm Ahmad Raza — a passionate Web Developer and Laravel enthusiast.