Rich Text Laravel

Explanation:
Rich Text Laravel is a package created by Tony Messias that integrates the Trix Editor (from 37 Signals) into your Laravel applications. If you are creating any kind of UI that requires users to type in long form text input via a text area field that needs to be formatted then more than likely you'll need to provide rich text editor functionality.
Install the Rich Text Laravel package via Composer:
Code:
composer require tonysm/rich-text-laravel Next, run the install command: php artisan richtext:install Update your model with the HasRichText trait and add $richTextAttributes property: <?php namespace App\Models; use Tonysm\RichTextLaravel\Models\Traits\HasRichText; class Product extends Model { use HasFactory; use HasRichText; /** * The dynamic rich text attributes. * * @var array<int|string, string> */ protected $richTextAttributes = [ 'description', ]; /** * The attributes that are mass assignable. * * @var array<int, string> */ protected $fillable = [ 'name', 'price', 'type', 'description', ]; ... } If you have any Form Request classes or Validation rules you will want to update those as well. For example: $this->validate([ 'name' => ['required', 'string', 'max:255'], 'price' => ['required', 'decimal:10,2'], 'type' => ['required'], 'description' => ['nullable', 'string'], ]) And finally you can then use the x-trix-input blade component to render the editor: <x-trix-input id="description" name="description" :value="old('description', $product->description?->toTrixHtml())" autocomplete="off" />
Comments :