Duplicate data records #346
Closed
dmAssecor
started this conversation in
Feature Requests
Replies: 2 comments 1 reply
-
I'm going to hold off adding a "Duplicate" action into Runway for the minute since it'll need to be configurable (not everyone will want it) but I'll keep this discussion open. In the meantime, drop this to your <?php
namespace App\Actions;
use Statamic\Actions\Action;
class DuplicateRecord extends Action
{
protected static $title = 'Duplicate';
public function visibleTo($item)
{
return $item instanceof \App\Models\Product;
}
public function run($items, $values)
{
$items->each(function ($item) {
$item->replicate()->save();
});
}
} You'll need to replace the |
Beta Was this translation helpful? Give feedback.
1 reply
-
Runway v6 will add a "Duplicate" action to models. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, we would like to have a feature where we can duplicate our already created data records with a click of a button in the table. Something like this already exists directly in the Statamic tables.
Would it be possible to implement this?
Beta Was this translation helpful? Give feedback.
All reactions