PHP code example of ycs77 / laravel-form-builder-fields

1. Go to this page and download the library: Download ycs77/laravel-form-builder-fields 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/ */

    

ycs77 / laravel-form-builder-fields example snippets




return [

    // Templates
    // ...
    'checkable_group' => 'laravel-form-builder::checkable_group',

    'custom_fields' => [
        'checkable_group' => '\Ycs77\LaravelFormBuilderFields\Fields\CheckableGroupType',
    ],
];


$this->add('field_name', 'checkable_group', [
    'choices' => [
        'en' => 'English',
        'fr' => 'French',
    ],
    'is_checkbox' => true, // False is radio
    'selected' => ['en'],
    'language_name' => 'test-lang-name',
    // 'choice_options' => [
    //     'wrapper' => [
    //         'class' => 'form-control',
    //     ],
    // ],
]);

$this->add('field_name', 'checkable_group', [
    ...
    'language_name' => false,
]);



return [
    'defaults' => [
        // ...

        'checkable_group' => [
            // 'wrapper_class' => 'form-group',
        ],

        'checkbox' => [
            // ...

            'choice_options' => [
                'wrapper_class' => 'custom-control custom-checkbox',
                'label_class' => 'custom-control-label',
                'field_class' => 'custom-control-input',
            ],
        ],

        'radio' => [
            // ...

            'choice_options' => [
                'wrapper_class' => 'custom-control custom-radio',
                'label_class' => 'custom-control-label',
                'field_class' => 'custom-control-input',
            ],
        ],
    ],
];




return [
    'defaults' => [
        // ...

        'checkable_group' => [
            'label_class' => 'col-lg-2 col-form-label text-lg-right pt-0',
        ],

        // Same...
    ],
];




return [

    // Templates
    // ...
    'rich_editor' => 'laravel-form-builder::rich_editor',

    'custom_fields' => [
        'rich_editor' => '\Ycs77\LaravelFormBuilderFields\Fields\RichEditorType',
    ],
];


$this->add('content', 'rich_editor');



namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Mews\Purifier\Facades\Purifier;

class PostController extends Controller
{
    public function store(Request $request)
    {
        $content = Purifier::clean($request->content);
    }
}




use Ycs77\LaravelFormBuilderFields\Facades\RichEditorUpload;

// Other routes...

RichEditorUpload::routes();

$this->add('content', 'rich_editor', [
    'upload_image' => true,
]);

'custom' => [
    'upload_file' => [
        '' => 'Upload file',
],



namespace App\Http\Controllers;

use Ycs77\LaravelFormBuilderFields\Http\Controllers\UploadController as BaseUploadController;

class UploadController extends BaseUploadController
{
    // ...
}

bash
php artisan vendor:publish --tag=laravel-form-builder-rich-editor-type