PHP code example of jeffersongoncalves / filament-yaml-editor

1. Go to this page and download the library: Download jeffersongoncalves/filament-yaml-editor 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/ */

    

jeffersongoncalves / filament-yaml-editor example snippets


use JeffersonGoncalves\FilamentYamlEditor\Forms\Components\YamlEditorField;

YamlEditorField::make('config')
    ->withToolbar()
    ->rules(['yaml'])

YamlEditorField::make('config')
    ->height(400)
    ->withToolbar()
    ->castState()
    ->autoFormat()
    ->dark()
    ->rules(['yaml'])
    ->placeholder("# paste your YAML here\n")

use JeffersonGoncalves\FilamentYamlEditor\Actions\ViewYamlAction;

->recordActions([
    ViewYamlAction::make()
        ->column('config')       //            // optional
])

->actions([
    ViewYamlAction::make()
        ->column('config'),
])

use JeffersonGoncalves\FilamentYamlEditor\Infolists\Components\YamlEditorEntry;

YamlEditorEntry::make('config')
    ->height(400)
    ->dark()

use JeffersonGoncalves\FilamentYamlEditor\Casts\YamlCast;

class Setting extends Model
{
    protected $casts = [
        'config' => YamlCast::class,
    ];
}

use JeffersonGoncalves\FilamentYamlEditor\Rules\ValidYaml;

// As a rule object
$request->validate([
    'config' => [''],
]);
bash
php artisan filament:assets
bash
php artisan vendor:publish --tag=filament-yaml-editor-config