I am trying to upload multiple images to a page edit form. In my PageTemplates.php , I have:
$this->crud->addField([ 'name' => 'images', 'label' => 'Fotos', 'type' => 'upload_multiple', 'upload' => true, 'disk' => 'uploads', 'hint' => 'Some hint text.', 'fake' => true ]);
In my page model , I have:
public function setImagessAttribute($value) { $attribute_name = "images"; $disk = "uploads"; $destination_path = "images/pages"; $this->uploadMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path); }
In my $ drive array in config / filesystems.php I have:
'uploads' => [ 'driver' => 'local', 'root' => public_path('uploads'), ],
But when I try to save the page, I have 2 problems:
- Images are not saved in the folder (the folder is writable!)
- Not saved to database
In my database, the field of additional functions for this page I get:
"images":[ { }, { } ],
What am I doing wrong?
source share