PHP code example of lednerb / nova-text-copy-field

1. Go to this page and download the library: Download lednerb/nova-text-copy-field library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lednerb / nova-text-copy-field example snippets


use Sixlive\TextCopy\TextCopy;

public function fields(Request $request)
{
    return [
        TextCopy::make('Example Copy Field', 'example_copy_field'),
    ];
}

TextCopy::make('Some Long Field')
    ->truncate(100)

TextCopy::make('Some Secret String', 'some_secret_string')
    ->mask('❌') // default '*'
    ->truncate(5)

TextCopy::make('Some Field', 'some_field')
    ->copyButtonTitle('Some alternative title')

TextCopy::make('Some Secret String', 'some_long_string')
    ->copyValue(function ($value) {
        return substr($value, -6);
    })

TextCopy::make('Some Secret String', 'some_long_string')
    ->copyValue('some fixed copy value')

TextCopy::make('Some Secret String', 'some_long_string')
    ->showButtonOnlyOnHover()