error: Array to string conversion

i am getting the error 'Array to string conversion' in this code:
Forms\Components\FileUpload::make('image')
->columnSpan('full')
->image()
->imageEditor()
->panelLayout('grid')
->multiple()
->directory('brands')
->maxFiles(5)
->reorderable()
->preserveFilenames(),
Forms\Components\FileUpload::make('image')
->columnSpan('full')
->image()
->imageEditor()
->panelLayout('grid')
->multiple()
->directory('brands')
->maxFiles(5)
->reorderable()
->preserveFilenames(),
how do i fix this???
6 Replies
LeandroFerreira
make sure that column has an array cast in your model, because you are using multiple
raheel3031
raheel30317d ago
where do i place the code? protected $casts = [ 'images' => 'array', ]; this code?
LeandroFerreira
yes, in your model. If you are using Laravel 11 https://laravel.com/docs/11.x/eloquent-mutators#array-and-json-casting
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
raheel3031
raheel30317d ago
no iam using 10. but somehow the image is not being saved now
LeandroFerreira
did you upload it again?
raheel3031
raheel30317d ago
this has been solved
Want results from more Discord servers?
Add your server