spatie media library file upload load file

I have a custom header with an image, and when the image is clicked, a Header action was dispatched.
How to show the current avatar image in the field?

    protected function getHeaderActions(): array
    {
        return [
            Action::make('changeAvatar')
                ->label('Canvia foto d\'alumne')
                ->modalWidth('sm')
                ->form([
                    SpatieMediaLibraryFileUpload::make('avatar')
                        ->alignCenter()
                        ->label('')
                        ->avatar()
                        ->collection('avatar')
                        ->circleCropper()
                        ->imageEditor()
                        ->acceptedFileTypes([
                            'image/png','image/jpg','image/jpeg'
                        ]),
                ])
        ];
    }
image.png
Was this page helpful?