© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•5mo ago•
4 replies
larsbo

RichEditor content is ignored

I have a simple schema:
public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Hidden::make('editor_id')
                    ->default(auth()->id()),

                TextInput::make('title')
                    ->label(__('Title'))
                    ->required()
                    ->maxLength(255),

                DateTimePicker::make('published_at')
                    ->label(__('Published at'))
                    ->displayFormat('d.m.Y, H:i')
                    ->native(false)
                    ->seconds(false)
                    ->nullable(),

                RichEditor::make('body')
                    ->label(__('Body'))
                    ->columnSpan('full'),

                Toggle::make('is_active')
                    ->label(__('Active'))
                    ->default(true),
            ]);
    }
public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Hidden::make('editor_id')
                    ->default(auth()->id()),

                TextInput::make('title')
                    ->label(__('Title'))
                    ->required()
                    ->maxLength(255),

                DateTimePicker::make('published_at')
                    ->label(__('Published at'))
                    ->displayFormat('d.m.Y, H:i')
                    ->native(false)
                    ->seconds(false)
                    ->nullable(),

                RichEditor::make('body')
                    ->label(__('Body'))
                    ->columnSpan('full'),

                Toggle::make('is_active')
                    ->label(__('Active'))
                    ->default(true),
            ]);
    }

When I save this I got an QueryException because the rich editor field (body) is missing:
General error: 1364 Field 'body' doesn't have a default value (Connection: mysql, SQL: insert into `announcements` (`editor_id`, `title`, `published_at`, `is_active`, `updated_at`, `created_at`) values (1, zuguz, ?, 1, 2025-09-25 17:31:35, 2025-09-25 17:31:35))
General error: 1364 Field 'body' doesn't have a default value (Connection: mysql, SQL: insert into `announcements` (`editor_id`, `title`, `published_at`, `is_active`, `updated_at`, `created_at`) values (1, zuguz, ?, 1, 2025-09-25 17:31:35, 2025-09-25 17:31:35))


If I replace the RichEditor with a Textarea field without any other changes it workes.
Solution
ok, wow. I solved it. The body column has to be nullable even the field is required - This is mentioned in the filament spatie media library documention but can easily be overlooked here: https://filamentphp.com/plugins/filament-spatie-media-library#using-media-library-for-rich-editor-file-attachments
Using SpatieMediaLibraryFileAttachmentProvider requires that the rich content attribute (content in this example) must be defined as nullable in database.
Filament
Spatie Media Library by Filament - Filament
Filament support for Spatie's Laravel Media Library package.
Spatie Media Library by Filament - Filament
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Render tag inside RichEditor content
FilamentFFilament / ❓┊help
2y ago
RichEditor
FilamentFFilament / ❓┊help
3y ago
Undefined variable $errors while editing richeditor field content
FilamentFFilament / ❓┊help
8mo ago
RichEditor is removing inline styles
FilamentFFilament / ❓┊help
12mo ago