post - Laravel, how cast object to new Eloquent Model? -


i via request json object. parse object in order check if may fit destination model.

instead of assigning property property. there quick way populate model incoming object?

you should convert object array , use fill($attributes) method.

as method name says, fill object provided values. keep in mind not persist database, have fire save() method after that.
or if want fill , persist in 1 method - there create($attributes) runs fill($attributes) , save() under hood.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -