PHP code example of degrinthorst / livewire-cms-editor
1. Go to this page and download the library: Download degrinthorst/livewire-cms-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/ */
degrinthorst / livewire-cms-editor example snippets
// config/cms-editor.php (driven by .env)
'columns' => [
'json' => env('CMS_EDITOR_JSON_COLUMN', 'body'), // source of truth, cast to array
'html' => env('CMS_EDITOR_HTML_COLUMN'), // null = render on the fly
],
use Degrinthorst\CmsEditor\Concerns\AdoptsEditorMedia;
use Degrinthorst\CmsEditor\Concerns\InteractsWithEditorMedia;
use Degrinthorst\CmsEditor\Contracts\HasEditorMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class Article extends Model implements HasEditorMedia
{
use InteractsWithMedia;
use InteractsWithEditorMedia;
use AdoptsEditorMedia; // claims inserted images on save (recommended)
public function registerMediaCollections(): void
{
$this->registerEditorMediaCollection();
}
protected $casts = ['body' => 'array']; // ProseMirror JSON (ADR-003)
}