F
Filament7mo 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
awcodes7mo 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.
Want results from more Discord servers?
Add your server