Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding PersonalInfo doesn't work #322

Open
DanielvdSpoel opened this issue Jan 17, 2024 · 4 comments
Open

Overriding PersonalInfo doesn't work #322

DanielvdSpoel opened this issue Jan 17, 2024 · 4 comments

Comments

@DanielvdSpoel
Copy link

I have this class to let users update their first_name and last_name as well, but as soon as I click update the component springs back to its original one and it says "The name field is required"

class PersonalInfo extends BreezyPersonalInfo
{
    public array $only = ['display_name', 'first_name', 'last_name', 'email'];
    protected function getProfileFormSchema(): array
    {
        return [
            Forms\Components\Group::make([
                Forms\Components\Grid::make()
                    ->schema([
                        Forms\Components\TextInput::make('first_name')
                            ->required(),
                        Forms\Components\TextInput::make('last_name')
                            ->required(),
                    ])
                    ->columns(2),
                Forms\Components\TextInput::make('display_name')
                    ->unique($this->userClass, ignorable: $this->user),
                Forms\Components\TextInput::make('email')
                    ->required()
                    ->email()
                    ->unique($this->userClass, ignorable: $this->user)
                    ->label(__('filament-breezy::default.fields.email')),
            ])->columnSpan(3)
        ];
    }
}```
@icaliman
Copy link

icaliman commented Feb 8, 2024

I have the same issue.

One solution is to replace the Livewire components after panel boot:

use Jeffgreco13\FilamentBreezy\BreezyCore;
use App\Http\Livewire\CustomPersonalInfo;

class CustomersPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ...
            ->plugin(
                BreezyCore::make()
                    ->myProfile()
                    ->myProfileComponents([
                        'personal_info' => CustomPersonalInfo::class,
                    ])
            )
            ->bootUsing(function () {
                Livewire::component('personal_info', CustomPersonalInfo::class);
            })
    }
}

@bobwurtz
Copy link

Thank you @icaliman! This just saved me. Do you know why is this necessary?

@JVillator0
Copy link

I have the same issue.

One solution is to replace the Livewire components after panel boot:

use Jeffgreco13\FilamentBreezy\BreezyCore;
use App\Http\Livewire\CustomPersonalInfo;

class CustomersPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ...
            ->plugin(
                BreezyCore::make()
                    ->myProfile()
                    ->myProfileComponents([
                        'personal_info' => CustomPersonalInfo::class,
                    ])
            )
            ->bootUsing(function () {
                Livewire::component('personal_info', CustomPersonalInfo::class);
            })
    }
}

When I try to add the livewire component inside other folders like App/Livewire/Auth/Profile/Timezone.php, when I click the save button, I get this error:

include(/var/www/html/vendor/composer/../../app/Livewire/ChangeTimezone.php): Failed to open stream: No such file or directory

Do you have any idea what it could be?

@bobwurtz
Copy link

bobwurtz commented Nov 8, 2024

Breezy has had issues in the past with trying to use components outside of the main App/Livewire folder:

#219 (comment)

It's probably related to that. I think the comment I linked is claiming there is a way around the issue but I've never tried it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants