Issues creating record with multi-file upload

Hello everyone, I have created a simple resource including the following FileUpload.
FileUpload::make('attachments')
->directory('transaction_attachments')
->multiple()
->columnSpanFull(),
FileUpload::make('attachments')
->directory('transaction_attachments')
->multiple()
->columnSpanFull(),
Which uses the json type in the database. However, when I want to save the resource, I get an Array to String conversion error. I am getting the following data all the way in the Str class.
6 => array:2 [
0 => "transaction_attachments/A9w9noTN1feXWe8gWpLOt0qD25fSmv-metad291dGVyX3Zhbl9tYXJydW0ucGRm-.pdf"
1 => "transaction_attachments/uGq6pUXNVWwQtoTk5UxcnZelzcPJnB-metaTWJvIE1lZGV3ZXJrZXIgSUNUIC0gRU4ucGRm-.pdf"
]
6 => array:2 [
0 => "transaction_attachments/A9w9noTN1feXWe8gWpLOt0qD25fSmv-metad291dGVyX3Zhbl9tYXJydW0ucGRm-.pdf"
1 => "transaction_attachments/uGq6pUXNVWwQtoTk5UxcnZelzcPJnB-metaTWJvIE1lZGV3ZXJrZXIgSUNUIC0gRU4ucGRm-.pdf"
]
The error is being thrown in: vendor/filament/filament/src/Resources/Pages/CreateRecord.php:137 Which is the handleRecordCreation method. And to top off the information regarding the model I have the following setup aside from relations:
protected $guarded = [];

protected $cast = [
'type' => TransactionTypes::class,
'attachments' => 'array',
];

protected $dates = [
'paid_at',
];
protected $guarded = [];

protected $cast = [
'type' => TransactionTypes::class,
'attachments' => 'array',
];

protected $dates = [
'paid_at',
];
Has anybody seen this before?
5 Replies
LeandroFerreira
protected $casts not $cast
wottavm
wottavmOP2y ago
Haven't even seen this. I will try this in the evening, Thanks for the catch tho. Hi @leandro_ferreira, Again thanks for noticing that typo. That was indeed the issue!
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
LeandroFerreira
Filament
Stacked Image Column by Kenneth Sese - Plugins - Filament
Stacked Image Column allows you to display multiple images as a stack in your Filament tables.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server