Today I want to tell you about one "hidden" Laravel feature which is in the system but not in documentation - replicate. This function allows you to make a copy of a row in the fastest way possible.
To start with, we are going to have a table:
We should see that our database row was replicated with new id and updated timestamps:
And that's it! With a few lines of code you can replicate a lot of data. This method works with loops too, so you can use this method to duplicate all of our entries.
No comments or questions yet...