Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fanisa's avatar

JetStream Profile Management - UpdateProfileInformationForm.php

Hello! There is a very interesting class in JetStream - UpdateProfileInformationForm which is situated at vendor folder. I can't edit it, I know, but there are two things, that I want to change in it. At this function:

public function updateProfileInformation(UpdatesUserProfileInformation $updater)
    {
        $this->resetErrorBag();

        $updater->update(
            Auth::user(),
            $this->photo
                ? array_merge($this->state, ['photo' => $this->photo])
                : $this->state
        );

        if (isset($this->photo)) {
            return redirect()->route('profile.show');
        }

        $this->emit('saved');

        $this->emit('refresh-navigation-dropdown');
    }

If a user do something with a photo, it is redirected, and I can no longer reach the events that go further, what I need. All I want to do, is to remove this block of code:

 if (isset($this->photo)) {
            return redirect()->route('profile.show');
        }

What is the best way to do it?

The second thing is that I want to add a property to this class, for example to do this:

<livewire:profile.update-profile-information-form :title="$title"/>

I think the solution should be the same as for the first question....

0 likes
9 replies
MarianoMoreyra's avatar

Hi @fanisa

If you publish the vendor's files, you'll be able to modify that component in particular:

php artisan vendor:publish --tag=jetstream-views

ref: https://jetstream.laravel.com/2.x/installation.html#livewire

Once you execute that command, you'll find the UpdateProfileInformationForm at app\Http\Livewire\UpdateProfileInformationForm.php

And the corresponding view at resources\views\profile\update-profile-information-form.blade.php

So doing this, you can change them as you want!

Hope this helps!

1 like
fanisa's avatar

Hi! I've published them before. So I have and can edit the view resources\views\profile\update-profile-information-form.blade.php. Also, I have access to the class UpdateUserProfileInformation.php from \app\Actions\Fortify\UpdateUserProfileInformation.php where I can change the set of fields for example. But... this function

public function updateProfileInformation(UpdatesUserProfileInformation $updater)
    {
        $this->resetErrorBag();

        $updater->update(
            Auth::user(),
            $this->photo
                ? array_merge($this->state, ['photo' => $this->photo])
                : $this->state
        );

        if (isset($this->photo)) {
            return redirect()->route('profile.show');
        } 

        $this->emit('saved');

        $this->emit('refresh-navigation-dropdown');
    }

is located at another class from \vendor\laravel\jetstream\src\Http\Livewire\UpdateProfileInformationForm.php There is no such file at app\Http\Livewire

1 like
MarianoMoreyra's avatar
Level 25

You're right @fanisa

That need some additional steps.

  1. First, create a Livewire folder inside app\Http\ if you don't already have one
  2. Create a UpdateProfileInformationForm.php inside that new Livewire folder
  3. Copy the content of the vendor file: \vendor\laravel\jetstream\src\Http\Livewire\UpdateProfileInformationForm.php
  4. In the boot method of your JetstreamServiceProvider add the following:
Livewire::component('profile.update-profile-information-form', UpdateProfileInformationForm::class);

Don't forget to use your version of the class at the top of the JetstreamServiceProvider

use App\Http\Livewire\UpdateProfileInformationForm;

Now you can customize your version of UpdateProfileInformationForm to your needs.

Please let me know if it doesn't work so I can see what else have I done to make this work in the past.

14 likes
fanisa's avatar

Super! It does work! It's a magic piece of code, that I needed:

Livewire::component('profile.update-profile-information-form', UpdateProfileInformationForm::class);

Thank you so much, genius!)

3 likes
eugenefvdm's avatar

What a lifesaver! For noobs like me I also has to change the namespace of the class after the copy:

// namespace Laravel\Jetstream\Http\Livewire;
namespace App\Http\Livewire;

But honestly if you're building something a little more sophisticated than normal this kind of customization is a must. It would be a great inclusion in the Jetstream Livewire documentation.

4 likes
lexusturning's avatar

Just as an extra, I found that I was able to add a user's alias from a separate aliases table to the $state array in the mount method, thusly (although, this is probably a crude implementation):

$this->state['alias'] = Alias::where('user_id',Auth::user()->id)->first()->alias;
xeisu's avatar

This is literally the only information about customizing/adding user fields using Jetstream when you try to Google it. This should be documented on the official documentation.

3 likes

Please or to participate in this conversation.