How can I populate repeater's relation in an action from

Tables\Actions\Action::make('show_reports')
->record(fn ($record) => $record)
->form([
Forms\Components\Repeater::make('reports')
->relationship('reports')
->disableItemCreation()
->disableItemDeletion()
->disableItemMovement()
->schema([
Forms\Components\TextInput::make('violation_id')
->disabled()
->disableLabel(),
Forms\Components\TextInput::make('admin_comment')
->disabled()
->disableLabel(),
])
])
->action(function () {
}),
Tables\Actions\Action::make('show_reports')
->record(fn ($record) => $record)
->form([
Forms\Components\Repeater::make('reports')
->relationship('reports')
->disableItemCreation()
->disableItemDeletion()
->disableItemMovement()
->schema([
Forms\Components\TextInput::make('violation_id')
->disabled()
->disableLabel(),
Forms\Components\TextInput::make('admin_comment')
->disabled()
->disableLabel(),
])
])
->action(function () {
}),
The repeater fields are empty I tried adding ->record(fn ($record) => $record) but did not work
Forms\Components\Repeater::make('reports')
->relationship('reports')
->disableItemCreation()
->disableItemDeletion()
->disableItemMovement()
->schema([
Forms\Components\TextInput::make('violation_id')
->disabled()
->disableLabel(),
Forms\Components\TextInput::make('admin_comment')
->disabled()
->disableLabel(),
])
Forms\Components\Repeater::make('reports')
->relationship('reports')
->disableItemCreation()
->disableItemDeletion()
->disableItemMovement()
->schema([
Forms\Components\TextInput::make('violation_id')
->disabled()
->disableLabel(),
Forms\Components\TextInput::make('admin_comment')
->disabled()
->disableLabel(),
])
This code works fine when I place it in the edit page form builder
1 Reply
LancelotGamer
LancelotGamerOP15mo ago
Found the solution Just replace the normal Action() to ViewAction()
Want results from more Discord servers?
Add your server