Custom Action on section with relation not doing anything

First some background information... I have a model that references another of the same model. This is editable in fillament by storing the schema components in a seperate function and then imported in both the main schema, and a section schema with a relation. This works great! Now i wish to create a custom action to copy the form data from the current form into the relations form. So i added an action on the section to copy the form data into the relationship form. This however does nothing at all... When i click the action it does load, it does send a request over the network but nothing happens. I added a notification for troubleshooting, and it never shows... However, as soon as i remove the ->relationship from the section, the action does trigger. Any suggestions?
public static function configure(Schema $schema): Schema
{
return $schema
->schema([
...self::getComponents($schema),
Section::make('Paired connector')
->columnSpanFull()
->collapsible()
->collapsed()
->relationship('pairedConnector', fn(?array $state) => filled($state['name']))
->schema([
...self::getComponents($schema, false),
])
->headerActions([
Action::make('copyFormContent')
->label('Copy Form Content')
->icon('heroicon-m-sparkles')
->action(function (Set $set, Get $get) {

// Send a notification to prove it's firing
Notification::make()
->title('Action is working!')
->success()
->send();
}),
]),
]);
}
public static function configure(Schema $schema): Schema
{
return $schema
->schema([
...self::getComponents($schema),
Section::make('Paired connector')
->columnSpanFull()
->collapsible()
->collapsed()
->relationship('pairedConnector', fn(?array $state) => filled($state['name']))
->schema([
...self::getComponents($schema, false),
])
->headerActions([
Action::make('copyFormContent')
->label('Copy Form Content')
->icon('heroicon-m-sparkles')
->action(function (Set $set, Get $get) {

// Send a notification to prove it's firing
Notification::make()
->title('Action is working!')
->success()
->send();
}),
]),
]);
}
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?