💫 The magic of Inertia.js with the simplicity of Blade 💫 - Splade provides a super easy way to build Single Page Applications (SPA) using standard Laravel Blade templates, and sparkle it to make it interactive. All without ever leaving Blade.
Dev environment (OS, Sail/Valet/etc): Ubuntu 22.04, Nginx
Description:
When I upload multiple files to an empty spatie media collection, only the last file in the array is stored. But if I then go back into the SAME form and add another 2 files, all 3 will be saved. When I do the initial post I can see the multiple files being sent to the backend and after that first file is in the collection everything behaves exactly the way it should. But if I remove all files from the collection and try to add multiple files again it will once again only sync the last file in the array.
Steps To Reproduce Issue:
Create a model with a spatie media collection.
public function registerMediaCollections(): void
{
$this->addMediaCollection('files');
}
Create a form with a file upload.
public function addFiles(Topic $topic)
{
$files = ExistingFile::fromMediaLibrary($topic->getMedia('files'));
return view('admin.teachers.addFiles', ['topic' => $topic, 'files' => $files]);
}
Description:
When I upload multiple files to an empty spatie media collection, only the last file in the array is stored. But if I then go back into the SAME form and add another 2 files, all 3 will be saved. When I do the initial post I can see the multiple files being sent to the backend and after that first file is in the collection everything behaves exactly the way it should. But if I remove all files from the collection and try to add multiple files again it will once again only sync the last file in the array.
Steps To Reproduce Issue:
Create a model with a spatie media collection.
Create a form with a file upload.
admin.teachers.addFiles is a modal as per below
Use HandleSpladeFileUploads::syncMediaLibrary to save the uploaded files