How to add data to a model without creating a field

Hello! When creating a record, I want to add some data to a nested relationship (using a repeater). If I add a field to the form and enter data into it manually, everything works fine. But I would like to add this data programmatically, using for example afterStateUpdated. Without creating a field. Do I have this opportunity? Thanks for the possible answers! Code: Forms\Components\Repeater::make('attributes') ->label('Additional attributes') ->relationship('attributes') ->schema(function ($get, $set, $component) { return self::renderAttributesFields($get, $set, $component); } ) ->reactive() ->addable(false) ->deletable(false) ->hidden(function (Get $get): bool { if ($get('rule_type_id') !== null) { return empty(RuleType::find($get('rule_type_id'))->ruleAttributes->pluck('name')->toArray()); } return true; }) public static function renderAttributesFields(Get $get, Set $set): array { $arrayFields = []; if ($get('rule_type_id') !== null) { $ruleAttributes = RuleType::find($get('rule_type_id'))->ruleAttributes; foreach ($ruleAttributes as $item) { $arrayFields[] = Forms\Components\TextInput::make('rule_attribute_id');
//That's how it works. But I don't want to create a field, I would like to just //$set('rule_attribute_id', $item->id);
** return $arrayFields; }
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server