F
Filamentβ€’9mo ago
Alecto

Replicate to a different Model/Table

Hello, I am wondering if it's possible to replciate a record to a different table? I tried something like the below: ReplicateAction::make()->excludeAttributes(['instance_id','ruleId'])->beforeReplicaSaved(function (Model2 $replica): void{ }) But get an error stating I must use the same Model as the record. Any help appreciated. Thanks
Solution:
GitHub
Action Β· filamentphp filament Β· Discussion #11952
Package Actions Package Version v3.0.0 How can we help you? How do I create a table action that copies all record contents from one resource table to another resource table?
Jump to solution
5 Replies
toeknee
toekneeβ€’9mo ago
Make your own action, copy it and initiate a new record to your other table
Solution
LeandroFerreira
LeandroFerreiraβ€’9mo ago
GitHub
Action Β· filamentphp filament Β· Discussion #11952
Package Actions Package Version v3.0.0 How can we help you? How do I create a table action that copies all record contents from one resource table to another resource table?
Alecto
AlectoOPβ€’9mo ago
You're my new favourite person, thank you very much! Yeah, I knew that was an option, was just hoping there was another way. I'll try Leandro's suggestion. Thanks for your input!
toeknee
toekneeβ€’9mo ago
So Leandro's answer is exactly what I was saying πŸ™‚
Alecto
AlectoOPβ€’9mo ago
Sorry, I am too novice perhaps (you can be my second favourite) πŸ˜‰ Thank you both, it worked a treat.
Want results from more Discord servers?
Add your server