PHP code example of ekremogul / tena-editor

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

    

ekremogul / tena-editor example snippets


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) !!}



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 !!}
bash
php artisan vendor:publish --tag="tena-editor-config"
bash
php artisan vendor:publish --tag="tena-editor-views"