Closed antonioribeiro closed 10 years ago
Are you using the mass assignment rules as specified in the auto hydration section of the readme?
You must specify what fields you want to be hydrated (or alternatively what to specifically not fill) when Model->fill()
is called. This is called in the validation
method which is run prior to what was submitted in your pull request. Your pull request would make any attribute fillable which is not safe. It also wouldn't work for creating a new model as no attributes exist on a new model therefore nothing would be matched.
When you call save
it automatically calls validate
and validate
fills the model via Laravel's Model class based on mass assignment rules.
tl;dr: save
calls validate
which calls fill
which will work providing you specify what to fill.
I apologise for this, you were right. saveRecursive
auto filled but save
did not. I have fixed it in 830b3fe76c79ac8411c219941958bfd68a8af0b2 and will release 0.1.5 as soon as travis-ci finishes.
I was struggling to make a simple model save since yesterday, relations wasn't working either, but first I was just trying to make the parent to save, so I went to the Vocal code and could not find where
$data
was being used in the saving routine. Added this code to my fork and now it (parent saving) works fine.Since this is something really basic, I'm still wondering if I wasn't doing something wrong. Basically I had all my data in the request, which was correctly loaded by
saveRecursive()
, it was just not being used bysave()
.