F
Filament9mo ago
prskv.

Hello! When im saving my formData - FileUpload gives string like this "icons/01HXW41XREQJ420D95GMW"

Hello! When im saving my formData - FileUpload gives string like this "icons/01HXW41XREQJ420D95GMW", and when i trying to fill form im recieving this error: foreach() argument must be of type array|object, string given. How i can fix that?
Solution:
You should have an array cast on the column for your model
Jump to solution
8 Replies
Dennis Koch
Dennis Koch9mo ago
Cast your column as an array. I think it should also save as array.
prskv.
prskv.OP9mo ago
$data = $this->form->getState(); dd($data); this returned data of form
Dennis Koch
Dennis Koch9mo ago
Which one is the FileUpload?
prskv.
prskv.OP9mo ago
android-icon
Dennis Koch
Dennis Koch9mo ago
What happens when you cast it as an array? Doesn’t that work?
prskv.
prskv.OP9mo ago
That works now after cast to array. It turns out that you need to cast into an array when saving?
Solution
Dennis Koch
Dennis Koch9mo ago
You should have an array cast on the column for your model
prskv.
prskv.OP9mo ago
OK, thank you so much!

Did you find this page helpful?