Lupennat / nova-nested-many

Laravel Nova Nested Many
MIT License
15 stars 6 forks source link

Cannot assign Illuminate\Support\Collection to property Symfony\Component\HttpFoundation\Request::$files #27

Open AkselMeola opened 3 weeks ago

AkselMeola commented 3 weeks ago

Cannot assign Illuminate\Support\Collection to property Symfony\Component\HttpFoundation\Request::$files of type Symfony\Component\HttpFoundation\FileBag  

Cannot assign Illuminate\\Support\\Collection to property Symfony\\Component\\HttpFoundation\\Request::$files of type Symfony\\Component\\HttpFoundation\\FileBag at /var/www/vendor/lupennat/nova-nested-many/src/Fields/NestedStorable.php:339

Laravel Nova v4.35.0 Laravel version v11.21.0 Nested many v2.2.3


Seems that the types added here 0748393bf842727f71fcb110ce3d5b808e5a2df9 beak this.

Example:

// \Lupennat\NestedMany\Fields\NestedStorable::updateChild():364

//               ▼ -- Now a Filebag
$updateRequest->files = collect($request->file("{$this->attribute}.{$index}"));

I made a local fix that fixes this on my machine, but I did not dive into the code much to see if this is a final fix. So best if you verify yourself or I can attempt to make a PR with my fixes.

 $updateRequest->files = new FileBag($request->file("{$this->attribute}.{$index}", []));
AkselMeola commented 3 weeks ago

This is duplicate of https://github.com/Lupennat/nova-nested-many/pull/26, but I don't see this fix in the support-v2 branch.