Data type for FileUpload

I have simple Page, generated with php artisan make:filament-page In there I have a Form with multiple components, one of them being FileUpload (for uploading image). The property I want to use to store the image name is $quote_1_image. In databases this column is a string.
public ?string $quote_1_image;

public function mount(): void
{
$this->homePage = \App\Models\Pages\HomePage::find(1);
$this->form->fill($this->homePage->toArray());
}

public function form(Form $form): Form
{
return $form->schema([
Forms\Components\FileUpload::make('quote_1_image')
->image(),
...
public ?string $quote_1_image;

public function mount(): void
{
$this->homePage = \App\Models\Pages\HomePage::find(1);
$this->form->fill($this->homePage->toArray());
}

public function form(Form $form): Form
{
return $form->schema([
Forms\Components\FileUpload::make('quote_1_image')
->image(),
...
I'm however getting this error: Cannot assign array to property App\Filament\Pages\HomePage::$quote_1_image of type ?string When I change the datatype to array, the error says: Cannot assign string to property App\Filament\Pages\HomePage::$quote_1_image of type ?array
0 Replies
No replies yetBe the first to reply to this messageJoin