FilamentF
Filament3y ago
2 replies
eazy

Nested RepeatableEntry shows duplicate values from first relation

I have a nested RepeatableEntry which always shows the values from the first relation it fetches. This is not correct.
My RepeatableEntry:
RepeatableEntry::make('batchItems')
                            ->schema([
                                Section::make('entry')
                                    ->heading(fn(BatchItem $batchItem) => $batchItem->item->name)
                                    ->collapsible()
                                    ->schema([
                                        RepeatableEntry::make('pallets')
                                            ->schema([
                                                TextEntry::make('label'),
                                            ])
                                    ]),
                            ]),


My query on my resource:
    public static function getEloquentQuery(): Builder
    {
        return Batch::query()
            ->with([
                'batchItems' => [
                    'item',
                    'pallets' => [
                        'location',
                        'storageRoom',
                        'storageRoomColumn',
                    ]
                ],
            ]);
    }

As you can see in the screenshot I always get two pallets with the same values. This is not correct some should have more than 2, less than 2 or no pallets.
image.png
Was this page helpful?