Imagine you have a "Post" model and you want to replicate it, you can do so like below.
// retrieve the first post $post = Post::first(); // replicate the first post and save it as a new post $post->replicate()->save();
Now when you have a look on the database, you will have a new record with the same exact content as the one you have replicated but with a different "id" (identifier) since it's unique.
Leave a reply