andeancondor_74
andeancondor_74
FFilament
Created by andeancondor_74 on 6/8/2024 in #❓┊help
mutateFormDataBeforeCreate not running on create from Relation Manager
Thank you both. It worked. Much appreciated!
6 replies
FFilament
Created by andeancondor_74 on 2/13/2024 in #❓┊help
Custom Action in the Resource Edit Page
Thanks for your reply. Below is my code:
Essentially I want the mutateFormDataBeforeSave(), getRedirectUrl(). getSavedNotificationTitle() methods to run for the custom action finalize_application and NOT for the default EditAction Save changes: class EditApplication extends EditRecord { protected static string $resource = ApplicationResource::class; protected function getHeaderActions(): array { return [ Actions\DeleteAction::make(), ]; } protected function getFormActions(): array { return [ $this->getSaveFormAction(), Action::make('finalize_application') ->label('Finalize Application') ->color('success') ->visible(function ($record) { return $record->status === (Status::IN_PROGRESS); }) ->action('finalize'), ]; } public function finalize():void { $this->data['status'] = Status::IN_REVIEW; $this->getRecord()->update($this->data); } protected function mutateFormDataBeforeSave(array $data): array { $data['accept_admission_deadline'] = Application::getAcceptAdmissionDeadline(); return $data; } protected function getRedirectUrl(): string { return $this->getResource()::getUrl('index'); } protected function getSavedNotificationTitle(): ?string { return 'Application updated'; } }
4 replies