PHP code example of novadaemon / filament-pretty-json
1. Go to this page and download the library: Download novadaemon/filament-pretty-json 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/ */
novadaemon / filament-pretty-json example snippets
use Novadaemon\FilamentPrettyJson\PrettyJson;
class FileResource extends Resource
{
public static function form(Form $form): Form
{
return $form
->schema([
PrettyJson::make('json')
]);
}
}
/**
* @var string[]
*/
protected $casts = [
'card_info' => 'string',
// OR 'card_info' => 'json',
// OR 'card_info' => 'array',
// OR 'card_info' => 'object',
// OR 'card_info' => AsArrayObject::class,
// OR 'card_info' => CustomCast::class,
];
PrettyJson::make('card_info')
->copyable()
->copyMessage('Your JSON is copied to the clipboard')
->copyMessageDuration(1500)