I'm trying to upload multiple images on 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 $disks 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:
In my database extras field for that page I get:
"images":[
{
},
{
}
],
What am I doing wrong?
It worked after doing the following:
$fillable
in Page model'fake' => true
from PageTemplates.phpIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With