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

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -