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

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

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

java - Cannot secure connection using TLS -