BasketMC
BasketMC
FFilament
Created by BasketMC on 1/26/2024 in #❓┊help
Relationship Repeater in EditRecord saves before beforeSave?
What I am trying to do: Create a group of changes when someone creates or updates records in Filament. Some of the elements are repeaters with relationships. What I did: I'm able to do this properly in the CreateRecord because all of the creating happens between beforeCreate and afterCreate. However, in the EditRecord I tried to use the beforeSave and afterSave, but the relationship repeater ends up being saved within the $data = $this->form->getState()
$this->callHook('beforeValidate');

$data = $this->form->getState();

$this->callHook('afterValidate');
$this->callHook('beforeValidate');

$data = $this->form->getState();

$this->callHook('afterValidate');
My issue/the error: I tried to get around the issue by adding my grouping code into the beforeValidate, but then I end up with empty groups when the validation fails. My question: Is there some other event that I haven't found yet that I can listen within the EditRecord page that will trigger after all the validation, and before any relationship repeaters are saved? My initial expectation was that the EditRecord would perform all of it's saving between beforeSave and afterSave, but it doesn't appear that's the case.
5 replies