Esempio n. 1
0
 public function removeImage($id, $attribute_name, $image_id)
 {
     $image = \ImageDriver::get($image_id);
     $item = $this->get($id);
     $item->{'images_' . $attribute_name}()->detach($image->id);
     \ImageDriver::delete($image_id);
     return $image;
 }
Esempio n. 2
0
 public function update($id, $data)
 {
     $definition = $this->get($id);
     if ($definition->type == 'image' && $data['file']) {
         $image = \ImageDriver::store(['file' => $data['file']]);
         $data['image_id'] = $image->id;
     }
     return parent::update($id, $data);
 }