F
Filament9mo ago
Jessy

Form button with relationship

How to have a button(visible if the record has the relationship) that opens the edit form of that relationship. I tried like
php
....ArticleForm
Forms\Components\Actions::make([
Action::make(__('Comment'))
->button()
->form([
....CommentForm
php
....ArticleForm
Forms\Components\Actions::make([
Action::make(__('Comment'))
->button()
->form([
....CommentForm
How to make the relationship? Or is there a better way to do this?
1 Reply
awcodes
awcodes9mo ago
Wouldn’t all records, have the relationship? And for the relationship you would attach/sync etc in the ->action() modifier of the action. $livewire->getRecord()->comment()->attach([…]) for example.

Did you find this page helpful?