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
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.
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
Thanks! That clarifies it π