Michael Jones
Action forms taking long time to load once clicked on
I am looking for some help i have a number of actions in a form that open a slideover form. They take a long time to open once clicked on.
Forms\Components\Actions\Action::make('add_media')
->icon('heroicon-o-photo')
->badge(fn ($record) => is_array($record->media) ? count($record->media) : 0)
->form([
Forms\Components\FileUpload::make('media')
->disk('uploads')
->image()
->multiple()
->hiddenLabel(),
])
->modalSubmitActionLabel('Add media')
->closeModalByClickingAway(false)
->action(
function (Question $question, array $data) {
$currentMedia = $question->media;
foreach ($data['media'] as $media) {
$currentMedia[] = $media;
}
$question->update([
'media' => $currentMedia,
]);
Notification::make()
->title(count($data['media']) . ' media filename added successfully')
->success()
->send();
}
)
->after(function (Question $question, Set $set) {
$set('media', $question->media);
})
->slideover(),
5 replies