diff --git a/src/Filament/Blocks/RelatedResourceBlock.php b/src/Filament/Blocks/RelatedResourceBlock.php index db27e03a..b682ca00 100644 --- a/src/Filament/Blocks/RelatedResourceBlock.php +++ b/src/Filament/Blocks/RelatedResourceBlock.php @@ -2,18 +2,18 @@ namespace Portable\FilaCms\Filament\Blocks; -use FilamentTiptapEditor\TiptapBlock; - -use Filament\Forms\Components\TextInput; -use Filament\Forms\Components\Select; +use FilaCms; use Filament\Forms\Components\Group; use Filament\Forms\Components\Repeater; +use Filament\Forms\Components\Select; +use Filament\Forms\Components\TextInput; + use Filament\Forms\Get; use Filament\Forms\Set; -use FilaCms; +use FilamentTiptapEditor\TiptapBlock; use Str; class RelatedResourceBlock extends TiptapBlock @@ -63,7 +63,9 @@ public function getFormSchema(): array ->select('id', 'title') ->where('id', $state) ->first(); - $set('title', $article->title); + if($article) { + $set('title', $article->title); + } }) ->columnSpan(2), TextInput::make('title') @@ -71,6 +73,7 @@ public function getFormSchema(): array ]) ->columns(3) ]) + ->addActionLabel('Add Another') ]) ]) ]; diff --git a/views/filament/blocks/rendered/related-contents.blade.php b/views/filament/blocks/rendered/related-contents.blade.php index e69de29b..6a13bba8 100644 --- a/views/filament/blocks/rendered/related-contents.blade.php +++ b/views/filament/blocks/rendered/related-contents.blade.php @@ -0,0 +1,22 @@ +
+ +
+
+ @foreach ($selectedContents as $key => $item) + + @endforeach +
+
+