PHP code example of p1613m / laravel-editorjs

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

    

p1613m / laravel-editorjs example snippets


use App\Models\Post;

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



namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use AlAminFirdows\LaravelEditorJs\Facades\LaravelEditorJs;

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

$post = Post::find(1);
echo $post->body;
bash
php artisan vendor:publish --tag="laravel_editorjs-config"
bash
php artisan vendor:publish --tag="laravel_editorjs-views"