From 300b4f547e1b5698d5d46cea33000154f00084bf Mon Sep 17 00:00:00 2001 From: Michael Metdepenningen Date: Mon, 13 Nov 2023 16:51:31 +0100 Subject: [PATCH] support blocks with no fields --- src/FilamentPageBuilderServiceProvider.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/FilamentPageBuilderServiceProvider.php b/src/FilamentPageBuilderServiceProvider.php index 5ecfd5d..494856d 100644 --- a/src/FilamentPageBuilderServiceProvider.php +++ b/src/FilamentPageBuilderServiceProvider.php @@ -6,6 +6,7 @@ use Filament\Support\Facades\FilamentAsset; use Illuminate\Filesystem\Filesystem; use Sevendays\FilamentPageBuilder\Commands\MakePageBuilderBlock; +use Sevendays\FilamentPageBuilder\Models\Block; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; @@ -28,6 +29,15 @@ public function packageBooted(): void FilamentAsset::register([ Css::make('plugin-filament-page-builder', __DIR__.'/../resources/dist/filament-page-builder.css'), ], 'sevendays/filament-page-builder'); + + // support 'empty' form blocks + Block::creating(function (Block $model) { + if ($model->content == null) { + $model->content = []; + } + + return $model; + }); } public function register(): void