jangvel / nova-gutenberg
Implementation of the Gutenberg editor as a Laravel Nova Field based on Laraberg.
Installs: 2 687
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 2
Forks: 4
Open Issues: 1
Requires
- php: >=8.0
- laravel/framework: ^8.0|^9.0|^10.0
- laravel/nova: ^4.0
- van-ons/laraberg: ^2.0
README
A nova field for Laraberg
Requirements
php: >=8.0
laravel/nova: ^4.0
Installation
Install via composer
composer require jangvel/nova-gutenberg
Publish Laraberg files
php artisan vendor:publish --provider="VanOns\Laraberg\LarabergServiceProvider"
Laraberg provides a CSS file that should be present on the page you want to render content on:
<link rel="stylesheet" href="{{ asset('vendor/laraberg/css/laraberg.css') }}">
Usage
Simply register the field in your Resource
use Jangvel\NovaGutenberg\NovaGutenberg; public function fields(Request $request) { return [ NovaGutenberg::make(__('Content'), 'content'), ]; }
Add the RendersContent
trait to your model. And optionally define the $contentColumn
property to point to the column that holds your Laraberg content, this defaults to content
.
use Illuminate\Database\Eloquent\Model; use VanOns\Laraberg\Traits\RendersContent; class Post extends Model { use RendersContent; protected $contentColumn = 'content'; ... }
Call the render method on your model in a template.
{!! $model->render() !!}
Options
The field has a few options you can configure.
Height
You can customize the height of the editor.
NovaGutenberg::make(__('Content'), 'content')->height(600)