PHP code example of animalinstinct / laravel-backpack-editorjs

1. Go to this page and download the library: Download animalinstinct/laravel-backpack-editorjs 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/ */

    

animalinstinct / laravel-backpack-editorjs example snippets


'providers' => [
    // ...
    AnimalInstinct\LaravelBackpackEditorJs\LaravelBackpackEditorJsServiceProvider::class,
    // ...
]

    'middleware_class' => [
        //...
        \AnimalInstinct\LaravelBackpackEditorJs\app\Http\Middlewares\SetEditorJsParserContext::class,
        //...
    ]

//YourAnyCrudController.php

$this->crud->addField([
    'name' => 'description',
    'label' => 'Description',
    'type' => 'editorjs',
]);

//YourAnyModel.php

// Import the trait
use AnimalInstinct\LaravelBackpackEditorJs\app\Models\Traits\HasEditorJsFields;

// Use it in the model
use HasEditorJsFields;

// Declare the fields
protected $editorJsFields = ['description','anyfield'];

//YourAnyCrudController.php
use AnimalInstinct\LaravelBackpackEditorJs\app\Http\Controllers\Traits\EditorJsField;

use EditorJsField;

$this->crud->addField([
    'name' => 'description',
    'label' => 'Description',
    'type' => EditorJsField::withBackup($this->crud->getCurrentEntry(), 'description', 'ckeditor'),
]);
bash
php artisan backpack-editorjs:install