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

Don't work in edit form modal (editOptionForm) #18

Open
radimnemecek opened this issue Sep 2, 2024 · 1 comment
Open

Don't work in edit form modal (editOptionForm) #18

radimnemecek opened this issue Sep 2, 2024 · 1 comment

Comments

@radimnemecek
Copy link
Contributor

Is it somehow possible to add GazeBanner to the edit form modal ? I set the same identifier in both the modal in DeviceResource and the OwnerResource, but I get a 404 error. Is this just a bug or there is no way to set it in this situation?

No query results for model [App\Models\Device] 1
vendor/filament/filament/src/Resources/Pages/Concerns/InteractsWithRecord.php#26
Illuminate\Database\Eloquent\ModelNotFoundException

$record = static::getResource()::resolveRecordRouteBinding($key);

if ($record === null) {
    throw (new ModelNotFoundException)->setModel($this->getModel(), [$key]);
}

return $record;

My OwnerResource:

public static function form(Form $form): Form
    {
        return $form
            ->schema(
                GazeBanner::make()
                    ->identifier('owner')
                    ->lock()
                    ->canTakeControl()
                Forms\Components\TextInput::make('name')
                    ->required()
                    ->maxLength(255),
                ...
            );
    }

And my other resource DeviceResource with edit form modal:

public static function form(Form $form): Form
    {
        return $form
            ->schema(
                Forms\Components\Select::make('owner_id')
                    ->relationship('owner', 'name')
                    ->searchable()
                    ->preload()
                    ->editOptionForm([
                        GazeBanner::make()
                            ->identifier('owner')
                            ->lock()
                            ->canTakeControl()
                        Forms\Components\TextInput::make('name')
                            ->required()
                            ->maxLength(255),
                        ...
                    ])
                    ->required()
            );
    }

@0wain
Copy link
Collaborator

0wain commented Sep 3, 2024

Hey,

Thanks for reporting this issue.

I agree that this should be supported behaviour. It is likely an edge-case that needs to be accounted for. I will try to replicate your issue and implement a fix for it ASAP.

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

2 participants