public function setAttribute($key, $value)
    {
        if (array_key_exists($key, $this->attachedFiles)) {

            if ($value) {
                $attachedFile = $this->attachedFiles[ $key ];

                if ($value === $this->getDeleteAttachmentString()) {
                    $attachedFile->setToBeDeleted();
                    return;
                }

                /** @var StorableFileFactoryInterface $factory */
                $factory = app(StorableFileFactoryInterface::class);

                $attachedFile->setUploadedFile(
                    $factory->makeFromAny($value)
                );
            }

            $this->attachedUpdated = true;

            return;
        }

        parent::setAttribute($key, $value);
    }
public function setAttribute($key, $value)
    {
        if (array_key_exists($key, $this->attachedFiles)) {

            if ($value) {
                $attachedFile = $this->attachedFiles[ $key ];

                if ($value === $this->getDeleteAttachmentString()) {
                    $attachedFile->setToBeDeleted();
                    return;
                }

                /** @var StorableFileFactoryInterface $factory */
                $factory = app(StorableFileFactoryInterface::class);

                $attachedFile->setUploadedFile(
                    $factory->makeFromAny($value)
                );
            }

            $this->attachedUpdated = true;

            return;
        }

        parent::setAttribute($key, $value);
    }
public function setAttribute ( $ key , $ value ) { if ( array_key_exists ( $ key , $ this -> attachedFiles ) ) { if ( $ value ) { $ attachedFile = $ this -> attachedFiles [ $ key ] ; if ( $ value === $ this -> getDeleteAttachmentString ( ) ) { $ attachedFile -> setToBeDeleted ( ) ; return ; } /** @var StorableFileFactoryInterface $factory */ $ factory = app ( StorableFileFactoryInterface :: class ) ; $ attachedFile -> setUploadedFile ( $ factory -> makeFromAny ( $ value ) ) ; } $ this -> attachedUpdated = true ; return ; } parent :: setAttribute ( $ key , $ value ) ; }
Handles the setting of attachment objects.

@param string $key
@param mixed  $value
Handles the setting of attachment objects .