F
Filamentβ€’2y ago
bwubs

Difference between ->record() and ->model on action

Hi, I'm working with some table actions and I'm a bit confused. What are the differences between the ->record() method and the ->model() method?
3 Replies
toeknee
toekneeβ€’2y ago
A record if memory serves me correctly is a collection instance of the row/record, whereas model is a model instant from the form/current data. If you dd() on both you should see the differences.
Dan Harrin
Dan Harrinβ€’2y ago
record() passes a Model instance (for EditAction for example) model() passes a class string of a model (for CreateAction for example, there the record doesnt exist yet) if you pass record instead of model, we will infer the model type anyway
bwubs
bwubsOPβ€’2y ago
Thanks! That clarifies it πŸ™‚
Want results from more Discord servers?
Add your server