filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.31k stars 2.97k forks source link

FileUpload foreach() argument must be of type array|object, string given #8224

Closed pslxx closed 1 year ago

pslxx commented 1 year ago

Package

filament/filament

Package Version

V3.0.38

Laravel Version

10

Livewire Version

3.0.1

PHP Version

8.1

Problem description

image

` class Setting extends Page{ public array $data = [ 'file'=>'1.txt' ];

public function form(Form $form): Form { return $form->schema([ FileUpload::make('file')->label('file'), } } `

Expected behavior

`

Steps to reproduce

`

Reproduction repository

`

Relevant log output

`
github-actions[bot] commented 1 year ago

Hey @pslxx! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

Also, it doesn't look like you've provided much information on how to replicate the issue. Please edit your original post with clear steps we need to take.

pslxx commented 1 year ago
image image
sh4msi commented 11 months ago

I also have this problem in EditRecord Is there a solution?

@danharrin @pslxx

abanghendri commented 7 months ago

I also face this issue on laravel 11 and filament 3.2 is there any update for this Mr. @danharrin

danharrin commented 7 months ago

We do not investigate issues without reproduction repositories. If you submit a new issue with one, we will check it out. Please start from a blank Laravel app.

abanghendri commented 7 months ago

thanks Mr. @danharrin , I've created an issue #12076

abanghendri commented 7 months ago

Hi @pslxx @sh4msi , I also face that issue and make a new issue #12076 , I do this to fix it, try to change your data init from this

class Setting extends Page{
public array $data = [
'file'=>'1.txt'
];

to this:

class Setting extends Page{
public array $data = [
'file'=>['1.txt']
];

since $this->getState() should return and array, not string