Profile

You have the option to edit the current logged in user’s profile information (name, email, profile picture) and password. To access this page, just click the “Profile” link in the left sidebar or add /profile in the URL.

The app/Http/Livewire/Profile.php handles the update of the user information and password.

    public function mount() { $this->user = auth()->user(); }

    public function save()
    {
        $this->validate();

        $this->user->save();

        $this->showSavedAlert = true;
            
        }
    }

If you input the wrong data when editing the profile, don’t worry. Validation rules have been added to prevent this.

    protected $rules = [
        'user.first_name' => 'max:15',
        'user.last_name' => 'max:20',
        'user.birthday' => 'date_format:Y-m-d',
        'user.email' => 'email',
        'user.phone' => 'numeric',
        'user.gender' => '',
        'user.address' => 'max:20',
        'user.number' => 'numeric',
        'user.city' => 'max:20',
        'user.zip' => 'numeric',
    ];