PHP code example of valentin-morice / filament-sketchpad
1. Go to this page and download the library: Download valentin-morice/filament-sketchpad 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/ */
valentin-morice / filament-sketchpad example snippets
use ValentinMorice\FilamentSketchpad\Sketchpad;
use Filament\Schemas\Schema;
public static function form(Schema $schema): Schema
{
return $schema
->components([
Sketchpad::make('example'),
]);
}
// An infolist component is also available.
use ValentinMorice\FilamentSketchpad\SketchpadInfolist;
public static function infolist(Schema $schema): Schema
{
return $schema
->components([
SketchpadInfolist::make('example'),
]);
}
// Provide full or partial configuration.
// Keys 'undo' and 'redo' are mandatory.
$config = [
'undo' => [
'label' => 'Undo',
'icon' => 'heroicon-o-arrow-left',
'color' => 'gray',
],
'redo' => [
'label' => 'Redo',
'icon' => 'heroicon-o-arrow-right',
'color' => 'gray',
],
];
FilamentSketchpad::make('example')->history(array |Closure $config);
// Provide full or partial configuration.
// Keys 'clear' and 'reset' are mandatory.
$config = [
'clear' => [
'label' => 'Clear',
'icon' => 'heroicon-o-document',
'color' => 'gray',
],
'reset' => [
'label' => 'Reset',
'icon' => 'heroicon-o-trash',
'color' => 'gray',
],
];
FilamentSketchpad::make('example')->controls(array |Closure $config);
// Provide full or partial configuration.
$config = [
'label' => 'Download',
'icon' => 'heroicon-m-arrow-down-tray',
'color' => 'gray',
'filename' => 'my-sketch', // saved as my-sketch.png
];
FilamentSketchpad::make('example')->download(array |Closure $config);