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
toeknee2y 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 Harrin2y 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
bwubsOP2y ago
Thanks! That clarifies it 🙂

Did you find this page helpful?