PHP code example of sckatik / moonshine-editorjs

1. Go to this page and download the library: Download sckatik/moonshine-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/ */

    

sckatik / moonshine-editorjs example snippets


use App\Models\Post;
use Sckatik\MoonshineEditorJs\Facades\RenderEditorJs;
$post = Post::find(1);
echo RenderEditorJs::render($post->body);



namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Sckatik\MoonshineEditorJs\Facades\RenderEditorJs;

class Post extends Model
{
    public function getBodyAttribute()
    {
        return RenderEditorJs::render($this->attributes['body']);
    }
}

$post = Post::find(1);
echo $post->body;

 php artisan vendor:publish --tag="moonshine-editorjs-config"

 php artisan vendor:publish --tag="moonshine-editorjs-assets"

 php artisan vendor:publish --tag="moonshine-editorjs"