Save multiple images to Laravel Livewire

I’m trying to save the image addresses but I get the following error: Array to string conversion Laravel.

How should I save the routes of the images? in the official documentation that point does not indicate it.

my code is the following:

VIEW

<input wire:model="imagenes" type="file" class="form-control-file" multiple>

COMPONENT

use WithFileUploads;
public $imagenes = [];


foreach ($this->imagenes as $pathGalería) {
       $pathGalería->store('imagenesPropiedades');
}

$properties = Property::create([

    'imagenes' => $this->imagenes

]);

I get the error: Array to string conversion. Could you please help me.

I don’t think its a livewire problem? You try to save an array into the imagenes field of your Property model

1 Like