Skip to content
Tanvir Islam edited this page Mar 30, 2020 · 6 revisions

Copy Clone - A laravel nova package for cloning any resource data.

By →tanvirofficials

Install Copy-clone package to your nova project

$ composer require tanvirofficials/copy-clone

Usage

use Tanvirofficials\CopyClone\CopyClone;
CopyClone::make()
    ->withMeta([
        'resource' => 'posts', // resource url
        'model' => 'App\Post', // model path
        'id' => $this->id, // id of record
        'relations' => ['tags', 'comments'], // an array of any relations to load (nullable).
        'except' => ['status'], // an array of fields to not replicate (nullable).
        'override' => ['status' => 'published'] // an array of fields and values which will be set on the modal after Cloning(nullable).
    ]),

You can either place it on the bottom right or top right corner.

For the bottom right corner , place the code bellow all of your nova feild.

Demo Image 1.1

For the top right corner , place the code on the top of all of your nova feild.

Demo Image 1.2

You can customize the Copy clone button text→

CopyClone::make()
    ->withMeta([
           .... include other metas .... ,

          'button_text' => 'Custom Copy\Clone Button', // By deafult its copy\clone  icon.


    ]),
Demo image 1.3

You can customize your own dialogue box. By Default →

Customization of confirm dialogue box .

→Use title,body,confirm_button_text and cancle_button_text meta for customization

Demo image 2
CopyClone::make()
    ->withMeta([
           .... include other metas .... ,

           'title' => 'Custom Title',  // by default 'title' => 'Confirmation'
           'body' => 'Custom Body',   // by default 'body' => 'Are you sure ?'
           'confirm_button_text' => 'Custom Confirm Button' ,   // by default 'confirm_button_text' => 'Copy\Clone'
           'cancle_button_text' => 'Custom Cancle Button'   // by default 'cancle_button_text'  => 'Cancle'
    ]),
Demo image 3

→This package only available in Resource Detail page.