F
Filament2mo ago
Tieme

Difference between RepeatableEntry and Repeater

Hi All, Can someone explain me why the data is different between a RepeatableEntry and Repeater I have a action with slideover to show me records from a relationship (code below). The RepeatableEntry hase all of my records. The Repeater hase none of my records.
Action::make('show_some_regels')
->label('Bekijk opdrachtregels')
->slideOver()
->modal()
->schema([
RepeatableEntry::make('some_regels')
->hiddenLabel()
->columnSpanFull()
->columns(5)
->schema([
TextEntry::make('product_id')
->hiddenLabel(),
TextEntry::make('vat_id')
->hiddenLabel()
]),
Repeater::make('some_regels')
->hiddenLabel()
->disabled()
->table([
TableColumn::make('product_id'),
TableColumn::make('vat_id'),
])
->schema([
TextInput::make('product_id'),
TextInput::make('vat_id'),
]),
])
Action::make('show_some_regels')
->label('Bekijk opdrachtregels')
->slideOver()
->modal()
->schema([
RepeatableEntry::make('some_regels')
->hiddenLabel()
->columnSpanFull()
->columns(5)
->schema([
TextEntry::make('product_id')
->hiddenLabel(),
TextEntry::make('vat_id')
->hiddenLabel()
]),
Repeater::make('some_regels')
->hiddenLabel()
->disabled()
->table([
TableColumn::make('product_id'),
TableColumn::make('vat_id'),
])
->schema([
TextInput::make('product_id'),
TextInput::make('vat_id'),
]),
])
Thanks for the support!
No description
Solution:
I didn't understand what you said, anyway, this is the docs reference to fill the form with existing data
Jump to solution
8 Replies
LeandroFerreira
LeandroFerreira2mo ago
I think RepeatableEntry can detect your relationship, so you don't need to call the relationship method. However, inside the Repeater, you must specify the relationship method
Tieme
TiemeOP2mo ago
I have tried that, and it also giving me 0 results. Even when i dump the modify query on the relationship it will show a correct query but no data is displayed.
LeandroFerreira
LeandroFerreira2mo ago
provide the whole code that you are using in gist please
Tieme
TiemeOP2mo ago
Here is the gist : Not availible anymore
LeandroFerreira
LeandroFerreira2mo ago
if you are using a schema/form, I think you need to fill the form in the action using:
Action::make('show_gripp_regels')
...
->fillForm(fn (YourModel $record): array => $record->attributesToArray())
Action::make('show_gripp_regels')
...
->fillForm(fn (YourModel $record): array => $record->attributesToArray())
Tieme
TiemeOP2mo ago
Thanks, for this. With that i get data, only the relations are not loaded, thats because it is a array now (like product.name)
->fillForm(fn ($record): array => ['gripp_regels' => $record->gripp_regels->toArray() ?? []])
->fillForm(fn ($record): array => ['gripp_regels' => $record->gripp_regels->toArray() ?? []])
Solution
LeandroFerreira
LeandroFerreira2mo ago
I didn't understand what you said, anyway, this is the docs reference to fill the form with existing data
Tieme
TiemeOP2mo ago
Thanks, fillForm was the solution for this. Did not think of that because the RepeatableEntry worked out of the box.

Did you find this page helpful?