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
Post a Comment