Profile

A /profile page for every signed-in user: update name, email and avatar, change the password, manage two-factor authentication, delete the account. It renders in the user shell, not the admin shell.

The profile page with its information, password, two-factor and delete-account cards
/profile in the user shell: the photo drop zone beside the avatar, then the name and email fields.

What it adds

FilePurpose
app/Livewire/Profile/ProfilePage.php and the views under resources/views/livewire/profile/The page and its four cards
app/Livewire/Actions/Logout.phpUsed by the delete-account flow
database/migrations/*_add_avatar_path_to_users_table.php
resources/views/components/action-message.blade.phpThe "Saved." note on the cards
TwoFactorAuthenticatable in app/Models/Concerns/UiKitUser.phpAdded to the generated trait

Install

php artisan ui-kit:install-module profile

No required Composer packages. composer require intervention/image turns on automatic 200 by 200 avatar resizing; without it the upload is stored as sent.

What the installer changes

  • Adds the /profile route between the markers in routes/ui-kit-user.php.
  • Runs the avatar migration and php artisan storage:link, which the avatar upload needs.
  • Regenerates the UiKitUser trait with TwoFactorAuthenticatable and re-applies it.

Routes

RouteName
GET /profileprofile

Two-factor authentication

The card drives Fortify's actions end to end:

  1. Enable generates a secret and shows the QR code.
  2. Confirm, when Fortify's confirm option is on, asks for a code from the authenticator before the secret counts.
  3. Recovery codes are shown and can be regenerated.
  4. Disable removes the secret.

The installed config/fortify.php turns on Fortify's confirmPassword option. Since 0.4.1 the card honours it: enabling, disabling, showing and regenerating recovery codes first send the user to /confirm-password unless the password was confirmed within auth.password_timeout (three hours by default), and the confirm page returns them to /profile.

From the next sign-in the core login flow stages the challenge described under Core.

The page

Four cards, each a design-system panel:

  • Profile information. The photo is a round avatar showing the user's initials until a photo exists. Beside it, a drop zone labelled "Profile photo" takes a JPEG, PNG or WEBP up to 2 MB, dropped or chosen. Once a file is picked, Save photo and Cancel appear under it; Remove shows while a photo is set. Name and email follow, with a resend link for an unverified address, limited to six a minute per user (shared with the verify-email page).
  • Update password: current, new and confirm.
  • Two-factor authentication, described below.
  • Delete account. The button opens a ds::modal that asks for the password; deleting the account deletes the photo too. A wrong password keeps the dialog open with the error under the field; Cancel, the backdrop or Escape close it.

Avatars

Uploads are stored on the public disk under a random 40-character name (before 0.4.1 the name was the user's id, so every photo was guessable) with a content-derived extension; replacing a photo deletes the old file. The path is saved in users.avatar_path with forceFill(), so a stock User model needs no change to $fillable. (Before 0.4 the module used update(), which a stock model ignores, and the photo never saved; Troubleshooting has the fix for an older install.) ui-kit:doctor fails storage linked (profile avatars) when public/storage is missing.

The generated UiKitUser trait gains avatarUrl(): ?string, the public-disk URL or null, and the kit shows the photo wherever a user appears: the admin rail's footer, the admin user list and detail, and the user shell's header, which links to /profile.

Removing

Delete the Livewire components, views and the action-message Blade component, remove the route line between the user-route markers, roll back the avatar migration, remove TwoFactorAuthenticatable from the trait, and remove profile from installed_modules.

Was this page helpful?