F
Filament14mo ago
alcmz

Run a additional function when a Data is created in form builder

I have the following table Table 1: virtual_machine coulmn 1: id coulmn 2: name coulmn 3: terminal_max_count Table 2: terminal_vm column 1: id column 2: name column 3: virtual_machine_id (foreignId) Relationship is one2Many (1 VM has many TerminalVM) TerminalVM with a foreignId of virtual_machine_id. Whenever a Virtual Machine is created with input of terminal_max_count the TerminalVM will also be created with the amount of max count set . I did try something like $form->save etc etc but it's called undefined . Please be in mind that i'm fairly new to Laravel/Filament
5 Replies
Dan Harrin
Dan Harrin14mo ago
setSaveMethod() doesnt exist, i dont know where you found that? chatgpt? please look at the Creating Records page in the documentation, it tells you about how to customize all kinds of behaviour on that page
alcmz
alcmz14mo ago
Yes the setSaveMethod() was from chatgpt . I've check it out after some time of understanding it . I got it already
alcmz
alcmz14mo ago
i just add the following inside CreateVirtualMachine page . Kindly note that handleRecordCreation was generated from chatgpt prompt
Dan Harrin
Dan Harrin14mo ago
please dont use chatgpt, its shit at filament
alcmz
alcmz14mo ago
Yes indeed it is . I used it to generate some code logics/flows for me to get some understanding . Thanks anyway!