Skip to content

Profile Edit Page

Tony Lea edited this page Aug 7, 2023 · 1 revision

This is the documentation for profile/edit.blade.php

Table of Contents

  1. Description
  2. Dependencies
  3. Middleware
  4. State
  5. Methods
  6. Render

Description

This file is a Blade view responsible for allowing the user to edit their profile information, change password, and delete their account.

Dependencies

This file uses the following libraries:

  1. Laravel's Support Facades

    The file uses the Hash, Password, and Rule Facades from Laravel's Support library.

  2. Livewire's Volt functions

    The file uses the 'with', 'state', 'rules', and 'mount' functions from Livewire's Volt library.

  3. Laravel's Facade Auth

use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\Request;
use function Laravel\Folio\{middleware};
use function Livewire\Volt\{with, state, rules, mount};
use Illuminate\Validation\Rule;

Middleware

This file uses auth and verified middlewares:

middleware(['auth', 'verified']);

State

This file has six states:

  1. user - The authenticated user.
  2. name - The user's name.
  3. email - The user's email.
  4. current_password - The user's current password.
  5. new_password - The user's new password.
  6. new_password_confirmation - Confirmation of new password.
  7. delete_confirm_password - Confirmation to delete account.
state(['user' => auth()->user()])->locked();
state([ 
    'name' => '', 
    'email' => '', 
    'current_password' => '', 
    'new_password' => '', 
    'new_password_confirmation' => '',
    'delete_confirm_password' => '', 
]);

Methods

This file includes three methods: $updateProfile, $updatePassword, and $destroy.

  • $updateProfile - This method updates user's profile information.
  • $updatePassword - This method updates user's password.
  • $destroy - This method deletes user's account.

Render

The main rendering function uses layouts.dashboard file as the parent layout.

It contains three main sections:

  1. Update Profile Section: Allows users to update their name and email.
  2. Update Password Section: Allows users to update their password.
  3. Delete User Section: Allows users to delete their account.
<x-layouts.dashboard>
    <x-slot name="header">
    ...
    </x-slot>
    @volt('profile.edit')
    <div class="py-12">
    ...
    </div>
@endvolt
</x-layouts.dashboard>