public function setImages(array &$data, $file_model, $entity)
    {
        if (empty($data['images']) || empty($data[$entity . '_id'])) {
            return false;
        }

        foreach ($data['images'] as &$image) {
            if (empty($image['file_id'])) {
                $image['entity'] = $entity;
                $image['entity_id'] = $data[$entity . '_id'];
                $image['file_id'] = (int) $file_model->add($image);
            } else {
                $file_model->update($image['file_id'], $image);
            }
        }

        return true;
    }
public function setImages(array &$data, $file_model, $entity)
    {
        if (empty($data['images']) || empty($data[$entity . '_id'])) {
            return false;
        }

        foreach ($data['images'] as &$image) {
            if (empty($image['file_id'])) {
                $image['entity'] = $entity;
                $image['entity_id'] = $data[$entity . '_id'];
                $image['file_id'] = (int) $file_model->add($image);
            } else {
                $file_model->update($image['file_id'], $image);
            }
        }

        return true;
    }
public function setImages ( array & $ data , $ file_model , $ entity ) { if ( empty ( $ data [ 'images' ] ) || empty ( $ data [ $ entity . '_id' ] ) ) { return false ; } foreach ( $ data [ 'images' ] as & $ image ) { if ( empty ( $ image [ 'file_id' ] ) ) { $ image [ 'entity' ] = $ entity ; $ image [ 'entity_id' ] = $ data [ $ entity . '_id' ] ; $ image [ 'file_id' ] = ( int ) $ file_model -> add ( $ image ) ; } else { $ file_model -> update ( $ image [ 'file_id' ] , $ image ) ; } } return true ; }
Set entity images
@param array $data
@param \gplcart\core\models\File $file_model
@param string $entity
@return bool
Set entity images