database - Retrieving the object from a replicated row with Laravel/Eloquent -


i'm replicating database row , want return new row object.

$new_foo = foo::find($id)->replicate()->save(); print_r($new_foo); 

this returns 1 instead of new object created. thoughts?

in code, saving value returned save() method , not replicated model.

you need make slight change code save replicated model $new_foo

$new_foo = foo::find($id)->replicate(); $new_foo->save(); dd($new_foo); 

save() method returns boolean.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -