src/MediaTrait.php
public function saveMedia($file, $group = 'default', $type = 'single', $options = []) {
    $this->file = $file;
    $this->group = $group;
    $this->type   = $type;
    $this->options = $options;

    $this->setup();

    $this->parseOptions();

    if ($this->type == 'single') {
      $this->removeExistingMedia();
    }

    $result = $this->databasePut();

    $this->storagePut();

    return $result;
  }
public function saveMedia($file, $group = 'default', $type = 'single', $options = []) {
    $this->file = $file;
    $this->group = $group;
    $this->type   = $type;
    $this->options = $options;

    $this->setup();

    $this->parseOptions();

    if ($this->type == 'single') {
      $this->removeExistingMedia();
    }

    $result = $this->databasePut();

    $this->storagePut();

    return $result;
  }
Save the media to disk and DB

@param $file object
The Symfony\Component\HttpFoundation\File\UploadedFile Object

@param $group string
The group of file being uploaded, to allow for say a profile picture and a
background to be uploaded for a user

@param $type string
If the field is for a single file that gets deleted set it to 'single',
or if it is a multiple file upload, set it to 'multiple'

@param $options array
An array of extra options for the file

@return object
The Devfactory\Media\Models\Media Object