© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
8 replies
KingNii

Repeater and EditAction error

I have a list of items created from the Repeater Input and saved in DB as a json. When I used the edit action I get and error.
foreach() argument must be of type array|object, string given {"userId":1,"exception":"[object] (ErrorException(code: 0): foreach() argument must be of type array|object, string given at /var/www/html/vendor/filament/forms/src/Components/Repeater.php:783)

Below is how I try to 

->beforeFormFilled(function (EditAction $action, Order $record) {
                            // Runs before the form fields are populated from the database.
                            // dd(gettype(json_decode($record['items'],true)));
                            $record['items'] = json_decode($record['items'], true);
                        })
 dd(gettype(json_decode($record['items'])));
                            $record['items'] = json_decode($record['items'], true); 
foreach() argument must be of type array|object, string given {"userId":1,"exception":"[object] (ErrorException(code: 0): foreach() argument must be of type array|object, string given at /var/www/html/vendor/filament/forms/src/Components/Repeater.php:783)

Below is how I try to 

->beforeFormFilled(function (EditAction $action, Order $record) {
                            // Runs before the form fields are populated from the database.
                            // dd(gettype(json_decode($record['items'],true)));
                            $record['items'] = json_decode($record['items'], true);
                        })
 dd(gettype(json_decode($record['items'])));
                            $record['items'] = json_decode($record['items'], true); 
Solution
Right, but a repeater, unless it is a relationship, needs to be cast on the model as either array or json.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

EditAction in a Repeater
FilamentFFilament / ❓┊help
2y ago
CreateAction and EditAction not triggering
FilamentFFilament / ❓┊help
2y ago
EditAction hooks
FilamentFFilament / ❓┊help
3y ago
EditAction inside Action
FilamentFFilament / ❓┊help
3y ago