#laravel_trips
Explore tagged Tumblr posts
iampraveenak-blog · 6 years ago
Text
Replicate in Laravel Eloquent Model
Replicate is used to make a copy of a row. It’s a simple one, here’s the way to make a copy of database row
$order = Order::find($order_id); $newOrder = $order->replicate(); $newOrder->save();
You can also update the fields like
$order = Order::find($order_id); $newOrder = $order->replicate(); $newOrder->created_at=time(); $newOrder->currency='USD; $newOrder->save();
https://aktips.quora.com/Replicate-in-Laravel-Eloquent-Model
1 note · View note