samedi 18 novembre 2017

Laravel Backpack - Upload multiple in PageTemplate

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:

  • Images aren't saved in folder (folder is writeable!)
  • Not saved in database

In my database extras field for that page I get:

"images":[  
  {  

  },
  {  

  }
],

What am I doing wrong?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2j46XzG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire