F
Filament7mo 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 Koch7mo ago
Cast your column as an array. I think it should also save as array.
prskv.
prskv.OP7mo ago
$data = $this->form->getState(); dd($data); this returned data of form
Dennis Koch
Dennis Koch7mo ago
Which one is the FileUpload?
prskv.
prskv.OP7mo ago
android-icon
Dennis Koch
Dennis Koch7mo ago
What happens when you cast it as an array? Doesn’t that work?
prskv.
prskv.OP7mo 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 Koch7mo ago
You should have an array cast on the column for your model
prskv.
prskv.OP7mo ago
OK, thank you so much!
Want results from more Discord servers?
Add your server