File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Filament/RelationManagers Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ public function getForm(): array
138138 ->disabled (fn (string $ operation ) => $ operation === 'create ' )
139139 ->hint (fn (string $ operation ) => $ operation === 'create ' ? __ ('Fields can be added once the field is created. ' ) : '' )
140140 ->hintColor ('primary ' )
141- ->form ([
141+ ->schema ([
142142 Section::make ('Field ' )
143143 ->columns (3 )
144144 ->schema ([
Original file line number Diff line number Diff line change @@ -105,12 +105,19 @@ public function form(Schema $schema): Schema
105105 })
106106 ->searchable ()
107107 ->preload ()
108- ->options (function () {
109- return Field::pluck ('group ' )
108+ ->options (function (Get $ get ) {
109+ $ existingGroups = Field::pluck ('group ' )
110110 ->filter ()
111111 ->unique ()
112112 ->mapWithKeys (fn ($ group ) => [$ group => $ group ])
113113 ->toArray ();
114+
115+ $ currentValue = $ get ('group ' );
116+ if ($ currentValue && ! array_key_exists ($ currentValue , $ existingGroups )) {
117+ $ existingGroups [$ currentValue ] = $ currentValue ;
118+ }
119+
120+ return $ existingGroups ;
114121 }),
115122
116123 ]),
You can’t perform that action at this time.
0 commit comments