Laravel 5.5 introduces a new streamlined request validation. The idea being that:
$validData = $request->validate($rules)
will return only those fields that are present in the $rules
. This is beneficial so that one can then simply User::create($validData)
or User::update($validData)
.
However, I noticed that when I have additional data, which I do validate, but that doesn't exist in the model's (this case User) table, the create
method inserts the record, but that the update
method returns this error:
Column not found: 1054 Unknown column 'column_name' in 'field list'
I can of course write the relevant field lists out, or use other workaround, but I wonder why are the two methods are behaving differently?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2AGRqwX
via IFTTT
Aucun commentaire:
Enregistrer un commentaire