ekremogul/tena-editor

TenaHaber EditorJS Helper

v1.1 2023-05-18 20:38 UTC

This package is auto-updated.

Last update: 2024-10-19 00:00:41 UTC


README

It was created by combining editor-js/editorjs-php and alaminfirdows/laravel-editorjs packages.

Special thanks to the developers

Installation

You can install the package via composer:

composer require ekremogul/tena-editor

You can publish the config file with:

php artisan vendor:publish --tag="tena-editor-config"

Optionally, you can publish the views using

php artisan vendor:publish --tag="tena-editor-views"

Usage

use Ekremogul\TenaEditor\TenaEditor;
use App\Models\Post;

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

// Or use in blade
{!! \Ekremogul\TenaEditor\TenaEditor::render($post->body) !!}

Defining An Accessor

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Ekremogul\TenaEditor\TenaEditor;

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

// usage
$post = Post::find(1);
echo $post->body;
// or use in blade
{!! $post->body !!}