Citizer
Citizer
FFilament
Created by Citizer on 7/25/2024 in #❓┊help
Using Livewire inside a form
No description
3 replies
FFilament
Created by Citizer on 7/16/2024 in #❓┊help
How get row id repeater in schema
No description
2 replies
FFilament
Created by Citizer on 7/15/2024 in #❓┊help
How to add an row to a repeater programmatically?
No description
8 replies
FFilament
Created by Citizer on 7/15/2024 in #❓┊help
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; }
2 replies
FFilament
Created by Citizer on 7/12/2024 in #❓┊help
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; }
2 replies