Displaying prefill data in action form select with relationship

Tables\Actions\Action::make('assign_role')
->form([
Forms\Components\Select::make('roles.name')
->relationship('roles', 'name')
->multiple()
->searchable()
->preload()
->native(false)
->required()
])
->action(function () {
...
})
Tables\Actions\Action::make('assign_role')
->form([
Forms\Components\Select::make('roles.name')
->relationship('roles', 'name')
->multiple()
->searchable()
->preload()
->native(false)
->required()
])
->action(function () {
...
})
I am wondering if this possible or not.
Solution:
You can do
->fillForm(fn($record) => return the data)
->fillForm(fn($record) => return the data)
...
Jump to solution
3 Replies
Solution
toeknee
toeknee2mo ago
You can do
->fillForm(fn($record) => return the data)
->fillForm(fn($record) => return the data)
toeknee
toeknee2mo ago
or I think you can do ->default([my data]) too
Rolland
RollandOP2mo ago
thank you that is working perfectly!
Want results from more Discord servers?
Add your server